real metalevel
Marcel Weiher
marcel at metaobject.com
Tue Aug 27 08:45:53 UTC 2002
On Tuesday, August 27, 2002, at 02:19 Uhr, Jecel Assumpcao Jr wrote:
>> Those aren't the only options. You can also have a "context" object
>> (holding the parameters) refering to the original object, which isn't
>> modified. Just like a method is neither copied nor modified when you
>> call it. It just looks at the MethodContext for parameters.
>
> That is an implementation optimization, not really another option. If
> the system automatically avoids copying immutable state then I don't
> have to think about these kinds of details.
Sorry, but I also find "invoke with arguments" easier to *think* about
than "make a copy, modify the copy, do something with the copy",
essentially because it is declarative. In fact, I currently see/use it
the other way around: making a copy and munging that is a (hidden)
implementation of a parametrized object.
This is pretty much where I think self went off in the wrong direction,
unifying too many different (if related) ideas with
low-level/imperative/time-dependent mechanisms and then having to
untangle the mess again, with great difficulty.
Yes, you can get away with tossing things like classes (and method
invocation), but while an interesting intellectual exercise, you aren't
actually helping your users, IMHO.
>>> Unless we don't care about reentrant methods, we had better copy
>>> them before sending "value". So, once again, this is like
>>> instanciation.
>>
>> Quite the contrary, re-entrant code is achived without making copies
>> of methods all the time. In fact, I strongly believe that
>> instantiation is too complex/messy/procedural most of the time using
>> just the example of methods/functions: just imagine that everytime
>> you wanted to call a method, you'd have to make a copy first, then
>> mutate that copy and finally send value to it!
>
> That is the story we tell (but don't actually implement ;-) in Self:
> contexts (called activation objects) are created by cloning methods and
> then changing them.
Once again, that seems like backwards to me: turning a simple
invocation into something conceptually more complex (time-dependent
etc.), then optimizing that away again.
Why not present the simple model to the user?
Marcel
--
Marcel Weiher Metaobject Software Technologies
marcel at metaobject.com www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
More information about the Squeak-dev
mailing list
|