[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: globals considered harmfull
>Now we can just say "point" and get a copy of the prototype, but
>must write "the point" when we really want to refer to the
>original prototype itself.
perhaps easier to read is:
"new point"
which is given by:
lobby _AddSlots:
(|
new = (| theGlobals =
(| defaultBehavior* = defaultBehavior.
globals* = globals |).
^undefinedSelector: sel Type: msgType Delegatee: del
MethodHolder: mh Arguments: args =
(( sel sendTo: new theGlobals WithArguments: args) copy) |)
|)
It could be argued that this code is less efficient, so should not be
used. Then again, it could be argued that Self is less efficient than
C so should not be used, but I don't agree with that either. ;-)
In any case, if the above code is too inefficient for a given
application it is trivial to give a parent to 'new' and put the
particular implementation of the copy into it...
-Ian
'In cyberspace nobody can hear you ook'