As stef said, this might result in a complex system at the end.
Is WideClass just an optimisation (not allocation for variable that
are not initialised)?
In that case, I would simply add some annotation either :
- on the class definition to say that a variable is lazy
- on its accessor/mutator
On 31 Aug 2007, at 23:52, Adrian Kuhn wrote:
As ESUG was so inspiring, I could not resist some VW hacking on the
If you browse to WideClass and WideClassTest on SCG Store, there is
a simple implementation of wide classes. As we have tons of empty
inst vars in moose models, that might help us to save some megas on
large case studies.
How to use it?
Sending #wide:put: to any object will install an instance var and
accessors on the receiver instance.
o := Object new.
o wide: #foo put: 4.
and even better, if you implement #foo and #foo: as follows
foo: arg self wide: #foo put: arg
upon first execution of #foo: the foo inst var is installed and
both methods get properly overriden with simple accessors. There is
no DNU hack anywhere!
Hope you have some fun playing around with it!
Alexandre Bergel http://www.bergel.eu