[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
What are we up to?
(1) instance variables
-- special syntax vs. ordinary symbols
-- semantics, when are defaults (if ever) copied down, active values,
access of IVs of other than self,...
I propose that the standard require that a method access its instance variables
using messages. The most important reason for this is that
using messages hides the implementation details -- a compiler could optimize
it using variable access, but maybe another implementation could do it differently.
Since deciding whether a property of an object is implemented by an
instance-variable or a method is often a time-space tradeoff, it's very helpful
to be able to change that decision without changing all the callers.
I use a macro (MY :VARIABLE) => (SEND SELF :VARIABLE), which looks nice, as in
(DEFOBJECT TURTLE (X Y PEN))
(DEFMETHOD (TURTLE :MOVE-TO) (NEW-X NEW-Y)
(DRAW-LINE (MY :X) (MY :Y) NEW-X NEW-Y (MY :PEN)))
(2) method combination
Flavors is a both a language for describing methods and a language
for describing method combination. I think most people that dislike
Flavors dislike the method combination language. Handerson has proposed
generalizing method combination but will that make things better.
SmallTalk has a notion of sending a message on along to the super of the
class in which the calling method is defined. Loops generalizes this
for multiple supers. This clearly is very general and is easier to use
and can be as efficient. What do people think?
I agree wholeheartedly that one of the major problems with Flavors is method
combination, and strongly urge that the standard not require method combination.
Multiple supers is much better, and should be provided for.
I think the standard should also require a mechanism called delegation, the
idea of one object forwarding a message to another object to reply in its stead.
This is subtly different from ordinary message sending, but allows you to
combine objects in place of combining methods.
I'll wait for discussion of inheritance mechanisms to explain the details
of delegation, which is discussed in some of the actor literature,
but I believe that delegation [along with multiple supers]
replace all plausible uses for method combination.