[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Microcode (and mentalcode) changes for message-passing - long msg

    1. Make calling of an Instance or an Entity bind %SELF.
I agree.

       This eliminates the need for the <- function.  This could be a macro that turns into
       a funcall, but personally I prefer the function syntax
       (message x y) over (<- x ':message y).

One obvious big advantage of Smalltalk is the generic messages ((<- x PRINT) as opposed
to (PRINT-DATA-TYPE-WITH-LONG-WINDED-NAME x). Why not have this and keep the Lisp
style (<function> .. args ..) semantics?

So if, as you say, if generic messages were macros they could expand into
either message passing or Lisp.  This unifies the two schemes, and even allows
the representation to be changed without restructuring the code.
(I understand that GSB has a package that does something like this in MACLISP.)

In the PRINT example the "-DATA-TYPE-WITH-LONG-WINDED-NAME" is in effect a type
declaration of X, present in the form (PRINT X).
If the declaration is left out,  run time type determination
has to happen by the "<-" business.  On the other hand, a compile time
type declaration (yes, ugh, but we do it!) allows more efficient code, especially
in the case of component references. Then at least, the type declaration can
be made less often than in every reference to X.

There probably is some problems with the short generic message names that people
would like to use being pre-empted. X and Y are free, but PRINT certainly already
has a function defintion.  Interestingly, it already does it's own type checking,
and escapes to message calling. It is Lisp's approximation to a generic message.

Does the macro definition  of X destroy the modularity of object clustered methods?
Do class defintions using X conflict with each other?
I don't think necessarily so, making X a generic merely means that it defaultly expands
to (<- foo 'X ...).  Where it interacts with a specific class is by some
class declaration (implicit or explicit), and the specifics of the X method
are still internal to the class itself.

   <- vs FUNCALL
The <- function also provides an escape for message passing to Lisp objects
that aren't defined as instances (numbers, strings, etc.).  Funcall could
be extended in those cases where it errors now, but certainly 
	(funcall '(lambda ....)...)  and   (<- '(...) ...)
have different semantics.  Of course <- should be know about by the
microcode and the compiler.

It might be nice to be able to change the method set for an existing
instance. For example, the old drawing program changes things from Body Pin
to a Point sometimes.  This could be done by copying, but there might
interesting applications where the gross behaviour of an instance was dynamic.
Maybe the CLASS and AUX-METHOD slots should be -1 and -2,
so that the slot numbers aren't different depending on whether there are aux-methods.

The current method dispatch matching could be haired up, it doesn't allow
a class to intercept every message for instance.

    3. Add new misc functions GET-INSTANCE-SLOT-{1..17,N} and
       PUT-INSTANCE-SLOT-{1..17,N} which allow access to slots of the
       instance designated by %SELF.  The compiler will need to be modified
       to know about a new class of variables, in addition to Special and
       Local, which are represented as Instance slots.  These need not
       appear in the ADL.

Maybe also the same things that take an instance pointer in place of %SELF.
This is analagous to the AREF-n macro instructions often discussed.