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

Re: Internals Proposal

Here is an alternative internal design for an object kernel, not
incompatible with that proposed by Steven Handerson.

The important difference between this design and that proposed by
Handerson is that it allows any datatype to act as a message receiver.
The LISP::SEND [[or â?? as we spell it in Loops]] uses a unique identifier
of the datatype, DTID.  [[In Interlisp-D/Loops this is an 8 bit
number.]]  From DTID, one finds a class indicator [[Loops indexes into
an array]] and a MethodApplyFn, used to find and apply the function
which implements the method [[Loops encodes this in the class indicator
table]].  The functions LISP::CLASS and LISP::METHODAPPLYFN are user
handles on these two properties of a datatype. 

The class indicator is one of 
	a) a class  -- for datatypes which have the same class for all
	b) T, a well known value which means that the class is found in 
	 in the first field of the datatype (a pointer field).
	c) Another atom, FN, which is a function to be applied to the object to
find its class. 
	d) NIL meaning not a receiver -- ERROR 

[[Loops uses  (e) a dotted pair, (methodApplyFn . classIndicator), if
the standard built into â?? is not to be used.]]

LISP::SEND then calls the MethodApplyFn function with the class,
selector,  instance and the rest of the arguments.  It finds the method
from the class associated with the selector, and if it exists, applies
the function to the arguments (in our case including  the instance as
the first argument).  If no such method exists then the message 

MessageNotUnderstood <object><selector> <argList>
	is sent to the object.  All classes are guaranteed to have 
	some response to this message.

[[In Loops we ensure that all objects have a class, with the default
class (we call it Tofu, since it has no flavor) handling the two
	Understands <selector> 
		which standardly returns T if the class can 
		handle (understand) a message with that <selector>
	MessageNotUnderstood which fields any message not understood.  
		This causes an ERROR or BREAK if no further behavior
		is specified in a class.
	Print <stream> ... which provides a default way of printing anything]]

For instance variable lookup, the class of any method is sent a message
CompileGetValue;  the class should know how to compile instance variable
lookup code.  

For interpretation of GetValue, the class of an object is sent a
	GetValue <object><ivName> ...
The class is an object itself, and it is responsible for knowing the
internal structure of instances of its type well enough to implement the
GetValue message.