[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
What are we up to?
Henry,
Could you expand a bit on how, and under what conditions, this use of
messages to access variables can be made efficient by the compiler?
Would we have to require that the decision about whether the slot is a
variable or method be frozen before anything referencing these slots is
compiled? If so, the flexibility you speak of seems a bit marginal. I
can't imagine that this idea will sell (at least for tense applications)
if it makes the inefficient form of access a near-universal default, so
getting the compiler to smash most of the cases most of the time would
seem to be crucial.
There certainly seems to be a lot of flexibility here if the efficiency
problem is not too bad. Would this sort of thing provide "active
values" in all of the senses that people care about? Looks to me like
it would, but I may be missing something.
If (MY :VARIABLE) turns into (SEND SELF :VARIABLE), what would SETF of
(MY :VARIABLE) turn into? And do we really want these varaible names to
be keywords?
I personally have no strong opinion about whether access to instance
variables has to look like access to regular variables or whether there
can be some special syntax for it. I mildly favor a special syntax, but
since my experience as a user of these systems is limited, I can't
really be sure that I would not find this to be a drag in the long run.
A special syntax would allow all sorts of things to be done with many
fewer hooks into the rest of the language, and would probably make it
much easier for mildly different object-oriented systems to co-exist.
On the other hand, I can see where people who are used to referencing
instance variables just like all other variables would view a special
syntax for this as a great leap backward, and one which they are
unwilling to take.
Perhaps if references to instance variables are only allowed within
certain lexical contexts (the bodies of certain macros and special
forms), and if the instance variables are known at the time of entry to
these forms, then the only hook we need is a "symbol macro" construct
that substitutes an arbitrary form for a symbol when it is seen within
some lexical form. Thus, within a defmethod for the flavor BAR we can
turn any reference to instance variable FOO into (MY FOO) or whatever.
Given that single hook, we could allow some systems to use special
syntax while others continue to use (or appear to use) variable-like
sytnax. (This is an idea that Steve Handerson has been pushing.) Of
course there still remains the problem of what the surface-level default
should be for an object-oriented system that we can all love.
-- Scott