[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r10381 - trunk/build/generator

From: Max Bowsher <maxb_at_ukf.net>
Date: 2004-07-24 01:41:55 CEST

Russell Yanofsky wrote:
> <maxb@tigris.org> wrote in message
> news:200407212231.i6LMVQ308385@morbius.ch.collab.net...
>> Author: maxb
>> Date: Wed Jul 21 17:31:26 2004
>> New Revision: 10381
>>
>> Modified:
>> trunk/build/generator/gen_base.py
>> trunk/build/generator/gen_make.py
>> trunk/build/generator/gen_win.py
>> Log:
>> Phase 1 of a series of refactorings of the build generator code, intended
to
>> make it easier to understand the architecture of Target and Section
classes.
>> ...
>> class Target(DependencyNode):
>> "A build target is a node in our dependency graph."
>>
>> - def __init__(self, name, options, cfg, extmap):
>> + def __init__(self, name, options, gen_obj):
>> self.name = name
>> + self.gen_obj = gen_obj
>
> I don't think targets should hold references to the generator object. The
> generator is a singleton, there's only one instance of it created for the
> entire program. It seems like a waste of space to create a bunch of target
> objects that all point to the same generator.

"waste of space"?

It seems sensible to me to give the Target objects a reference to the global
state of the generation process - the generator object.

> All other target members contain information about the target itself, and
> they are used by generor backends to generate build rules for the target.
> But the gen_obj member contains no information specific to the target, and
> it would never be used by any backend because backends can access the
> generator singleton directly.

It's purpose is not to be used by the backends, but to be used by the Target
object during add_dependencies().

BTW, does anyone else find it bizarre that you have to construct a Target
object, and then manually call what is effectively a "more_init" function
before it is useful?

> Hopefully, that argument makes some sense and is convincing. If not, I
think
> the "gen_obj" member should be renamed to "_generator." The leading
> underscore is appropriate for a private member that is only used
internally
> by Target methods. And losing the "_obj" suffix isn't a big deal because
it
> tells little about how the member is used or what it means (I usually
think
> the same thing about "_var", "_int", "_string" suffixes when they aren't
> there for disambiguation)

That, I agree with. It is a private member.

Max.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Jul 24 01:42:14 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.