Boost logo

Boost-Build :

From: David Abrahams (dave_at_[hidden])
Date: 2006-09-29 19:37:22


"Eric Niebler" <eric_at_[hidden]> writes:

> David Abrahams wrote:
>> "Eric Niebler" <eric_at_[hidden]> writes:
>>> So, test-suite is not a target, and explicit only works on targets.
>>> Fine.
>
>
> I take that back, I don't think that's fine. If "explicit" only works on
> targets, shouldn't it be an error to use it with something that isn't a
> target? With a useful error, like "blah-ext is not a target"?
>
>
>>> But what makes test-suite not a target? How can I tell based on
>>> the syntax of:
>>>
>>> test-suite blah : [ blarg.cpp ] ;
>>>
>>> that test-suite is not a target? Syntactically, it looks a lot like
>>> things which are targets, right?
>>
>> No, that looks like a rule invocation (a.k.a. function call). Whether
>> a rule invocation creates a target or not, and what that target is
>> called, is totally up to the implementation of the rule.
>
>
> Oh. So rules are like functions

No, rules are functions (no "like"). It's just the name the Perforce
people chose when they defined this crazy language.

> that modify global state

Or not.

> (the "targets," for example)? And the global state is implicit;
> that is, there is no explicitly declared variable that holds the
> targets. Or is there?

There are two levels of target here. The "targets" you think you're
declaring are held in some variables somewhere. Those in turn
generate real, low-level Jam targets which are not held in Jam
variables (they're held in variables in the C code that implements
Jam).

> And I would need to look at the documentation for that rule to
> determine if it creates a target, right? FWIW, I can't find where
> the test-suite rule is documented. I didn't look hard; did I
> overlooked it?

I don't know.

> But if my characterization above is accurate (functions modifying
> implicit global state), then I'm beginning to understand why I have
> such a hard time with BBv2.

I don't know how you'd do this reasonably otherwise. It doesn't make
much sense to pass around a big "state of all targets" blob.

> Thanks for taking the time to explain this.

Sure thing.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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