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

CommonLoops meets Object Lisp



In order to understand what would be involved in implementing ObjectLisp
on top of CommonLoops the CommonLoops group got together with Gary
Drescher to talk about it.

This message is a brief summary of what we discovered.  Understanding
this message requires familiarity with both CommonLoops (CLoops) and
ObjectLisp (OBL).

The major issues are:

1) Each ObjectLisp object is a hybrid of class and instance: it can be
   invoked like an instance, and other objects can inherit from it like
   a class.
2) In OBL method lookup is based on the "current object" (the value of
   the special variable *object*).  In Commonloops method lookup is
   based on the value of one or more of the arguments to the method.
3) In OBL both method-lookup and slot-access inherit from the global
   lisp environment if there is no object-binding.

The key points of the implementation scheme are:

1) Create a new discriminator mixin (discriminate-on-specials-mixin)
   which extends the behavior of the standard CommonLoops discriminator
   by allowing method lookup based on the value of special variables.
   OBL will use this to discriminate based on the value of *OBJECT*.
   Even though this discriminator mixin will discriminate on specials
   it will continue to use the standard CLoops method caching mechanisms.

2) Create a new metaclass object-lisp-metaclass which merges the CLoops
   class-instance relation and the CLoops class-subclass relation to get
   the OBL object-specialization relation.  In order to do this all OBL
   objects will include the object-lisp-metaclass as one of their
   superclasses.
     a) class-of for any OBL object will return the object itself,
     b) so that the superclasses of the class of an object will be the
        supers of the object itself,
     c) Each OBL-bound function FOO for object BAR will implemented
        as a method defined on bar "as a class".
     d) The object-lisp-metaclass will also support a new kind of
        slot-allocation which is a simple extension of :class
        allocation.  This allocation will allow objects and their
        specializations to share the same slot.
     e) The get-slot-using-class method for object-lisp-metaclass will
        implement the object lisp semantics of getting the global
        binding of a variable if that variable is not bound in the
        current object.