[Scons-users] Just abandoned an attempt to subclass Node.FS.Dir() .. alternative?
tshortik at gmx.de
Tue Dec 9 13:55:52 EST 2014
On 09.12.2014 14:07, Matthew Swabey wrote:
> I just finished an attempt to subclass Node.FS.Dir() to be a Modelsim
> library and the amount of code needing changes would probably be about
> 500 lines or more.
> So forget that idea.
> How about creating the Dir object and then appending attributes to
> identify it, custom builders that will use and modify those attributes
> and possibly adding some methods that can be used to manage how it
> works (thinking of overriding the signature detection/generation)?
> Then I could treat it as a Dir after instantiation (which is what most
> of the code that needs changes is all about - how many wrappers!).
> Thoughts? Potential pitfalls? I can imagine adding extra methods could
> be dangerous because of the need to memoize them etc.
one potential pitfall would be the planned switch to using __slots__
inside the Node class. So, adding methods will require you to derive
from the base class and add "slots" for your new methods. When adding
simple variables, please use the provided "Node.attributes" and attach
your infos there (you may want to check the Java/c builder for an
example)...this will stay during the refactoring.
More information about the Scons-users