I will have a look at it within 10 days.
Stef
On 7 sept. 07, at 17:31, Adrian Kuhn wrote:
Hey Stef, dear Moosers,
there is a new implementation of lazy (or dynamic, as I call them
now) inst vars for Moose. The new implementation is not based an
wide classes, but on anonymous subclasses, and includes very strict
sanity checks to guarantee type safety and Smalltalk's language model.
You may only extend a base class with an inst var, iff
name isString.
name isSymbol not.
name allSatisfy: #isLetter.
(case allInstVarNames includes: name) not.
class canUnderstand: name asSymbol.
class canUnderstand: (name copyWith: $:) asSymbol.
and you must implement the accessors in the class as follows
class >> foo
^self dynamicInstVarNamed: 'foo'
class >> foo: value
self dynamicInstVarNamed: 'foo' put: value
with this setup, we can guarantee that no tool is broken, neither
the browser, nor inspector and debugger or senders- and
implementors-of.
Except for the first write access, access time on an dynamic
instance variable is guaranteed to be the same as for "normal"
instance variables.
Please refer to DynamicInstVars and DynamicInstVarsTest on SCG
Store, for a first draft implementation.
cheers,
AA