From: David Abrahams (dave_at_[hidden])
Date: 2005-01-27 09:01:28
Pedro Ferreira <pedro.ferreira_at_[hidden]> writes:
> David Abrahams wrote:
> What about:
> def importXXX (manager, module_name):
> if not imported (module_name): import_the_module (module_name)
> if has_register_function (module_name): call_register_function
> (manager, module_name)
Yuck. Why bother with all that complexity?
>> 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.
> I'm with when you mention ease of use. By all means, it's easier to
> use globals. Then again, I think it's cleaner not to
Cleaner in what sense? It's not syntactically cleaner. It's not
> and am very
> worried that if we go down that path we'll regret it. More advice
Well, consider that what we're discussing are really global
*constants*. It's data that is initialized once and then never
touched again. Global constants don't present the same kinds of
problems as global variables do.
>>>Then Tools/Types/Cpp.py would be:
>>Please, can we have all_lowercase module names?!
> Sure, but that definitely is religious :-) What about class names and
> file names?
File names must be all_lower_case as well, to avoid SNAFUS across
platforms. And of course in Python filenames and module names
> Sure it sould be simpler to do
> types.type ('CPP', ['cpp', 'cxx', 'cc'])
> but I'm ready to trade neatness for security. Still, I agree with you
> that globals for types, features and similar are not showstoppers (bar
> the testability) but I feel uncomfortable about that. What do you
I think the anti-globals brush you are painting with is
well-intentioned but much too broad.
>>BTW, I know this is probably a religious issue, but space separating
>>function names from argument lists makes them hard to read because
>>can't visually "grep for [a-z](" to find all calls.
> It is religious but I don't have a problem with that. I'll try. BTW,
> what's the general feeling about that?
I know that some significant fraction of people do it your way. But
what can I say? They're just wrong ;-)
I don't know what makes me think that. Maybe it's years of writing
functions in math notation as f(x, y).
-- 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