Boost logo

Boost-Build :

Subject: Re: [Boost-build] jam/python function calling
From: Vladimir Prus (ghost_at_[hidden])
Date: 2010-07-19 09:23:05


On Friday 16 July 2010 16:45:34 Vladimir Prus wrote:

> On Thursday 15 July 2010 13:15:23 Juraj Ivančić wrote:
>
> > On 14.7.2010 21:06, Vladimir Prus wrote:
> > > I am starting to think that using exact signature from jam code is the
> > > best approach here. Using magic lists of integers that describe unpacking
> > > appears to be unmaintainable (even though the description has to be
> > > written only once, it better be readable)
> >
> > Exact signature needlessly duplicates parameter names. This hardly
> > increases readability IMHO.
>
> On the other hand, you can copy-paste signature from .jam file, and it
> will work.
>
> > How about this:
> >
> > @jam_signature( [ '..*', '*', '?', '?' ] )
> > def flags(rule_or_module, variable_name, condition, values, unchecked,
> > hack_hack):
> >
> > or
> >
> > @jam_signature( "..*:*:?:?" )
> > def flags(rule_or_module, variable_name, condition, values, unchecked,
> > hack_hack):
>
> This is indeed more terse -- and somewhat easier to parse.

Here's what I've checked in. Example usage is this:

        @bjam_signature((["rule_or_module", "variable_name", "condition", "*"],
                 ["values", "*"]))
        def flags (rule_or_module, variable_name, condition, values = []):

The important points of the solution are:

- The signature is actually communicated to bjam, so the error checking and
reporting remains exactly as it was before
- Keeping error reporting the same required that @bjam_signature duplicates
parameter names. This seems like a reasonable trade-off to me.

Thanks,

--
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build: http://boost.org/boost-build2



Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk