Boost logo

Boost-Build :

From: David Abrahams (dave_at_[hidden])
Date: 2005-01-25 10:01:22

Pedro Ferreira <pedro.ferreira_at_[hidden]> writes:

>>>> - stand alone modules that declare targets and features need
>>>> access to the current Manager
>>> Once there's a "current" Manager you have globals again.
>> There's one global variable. You still can freely test all modules
>> without interfering with anything.
> And only while we don't have things solid enough so we can redesign
> it.


>>>> , e.g. the ones in tools and tool/types:
>>> Those modules are "stand alone?" In what sense?
> Bad wording. I meant that, when they are loaded, global variables are
> 'automagically' set.

I still don't understand. Plus, I've lost the context. Can you
rephrase the whole statement and explain?

>>>> we can move the code in those modules into a function with a
>>>> well-known name, say 'register', which receives a Manager
>>>> instance as a parameter.
>>> I can't picture what you're describing.
> Consider tools/types/cpp.jam. With BBv2, when you import this module
> the type 'CPP' is added to the global list of types.
> Without global variables, you need to pass a context to the cpp.jam
> counterpart in PyBB.
> My proposal is to implement a function along the lines of:
> def importXXX (manager, module_name):
> import_the_module (module_name)
> if has_register_function (module_name):
> call_register_function (manager, module_name)

Hm. This doesn't make too much sense to me. After all, modules can
only be loaded once. Once they are loaded, their "globals" (really
module-local variables) have to be set. I'm feeling doubtful again
about the wisdom of subverting this model, especially because it fits
so well into Python's model for bindings in a module.

> Then Tools/Types/ would be:

Please, can we have all_lowercase module names?!

> def register (manager):
> manager.types ().type ('CPP', ['cpp', 'cxx', 'cc'])

Looks icky to me.

BTW, I know this is probably a religious issue, but space separating
function names from argument lists makes them hard to read because you
can't visually "grep for [a-z](" to find all calls.

Dave Abrahams
Boost Consulting

Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at