[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
What are we up to?
From: "Scott E. Fahlman" <Fahlman@CMU-CS-C.ARPA>
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?
No, of course not. The idea is that at compile time, a reference
(MY :VARIABLE) is compiled to a direct variable access, providing that
the class whose method this is in has a variable named :VARIABLE and
no other method named :VARIABLE. Otherwise it compiles (SEND SELF :VARIABLE).
It is possible that after this compilation the user could define a
method with that name, making obsolete that compilation. The defining
forms check for this and force recompilation or revert to interpreted version
for that reference. Flavors must do dynamic recompilation anyway for certain
sorts of definitional changes.
If (MY :VARIABLE) turns into (SEND SELF :VARIABLE), what would SETF of
(MY :VARIABLE) turn into?
In ZetaLisp, (SETF (MY :VARIABLE) NEW-VALUE) does exactly what you would
expect, sets the value of the instance variable to NEW-VALUE.