[armedbear-devel] Pdfdoclet - Javadoc for ABCL in PDF format
rudi at constantly.at
Thu Jul 25 14:39:37 UTC 2013
On Jul 24, 2013, at 04:02, Sean Champ <spchamp at me.com> wrote:
> On 07/23/2013 03:10 PM, Mark Evenson wrote:
>> On 7/23/13 11:34 PM, Sean Champ wrote:
>>> In looking at that idea, I'd been interested about how the CLOS support
>>> is implemented in ABCL, and whether and how MOP might be implemented,
>> As much of CLOS/MOP as possible has been implemented in Lisp: see clos.lisp.
> Took a look - so, MOP is implemented on the Lisp side, of course, and there's the documentation in clos.lisp denoting the Java classes effectively extended in the Common Lisp code - quite succinct.
> I think that I should not be too embarassed to denote that I'd only looked so far as to consult the Java API, when trying to construct a UML model for the MOP implementation in ABCL - not being aware, then, that ABCL may sort of extend the concept of class specialization, effectively in specializing Java classes with Common Lisp
Some general remarks / rambling about the MOP implementation follows. The only necessary low-level change to add CLOS / the MOP to a Lisp is support for funcallable objects. These are used to implement functions that change their behavior but keep their identity (i.e., generic function objects, which dispatch to methods depending on the type of the arguments).
Everything else can in principle be implemented in Lisp -- but since the metaclass structure has lots of circularity (class objects reference slot objects which have classes themselves) some low-level hackery is required to set up this spaghetti structure. In ABCL the lowest-level classes (slots, standard-class, the standard condition classes, some others) are set up in Java, together with an implementation of find-class. This is contained mostly in the file StandardClass.java. The (defconstant ...) forms at the beginning of clos.lisp show which MOP metaclasses were defined in Java. The rest of the metaclass hierarchy is created, after some normal functions are defined, via the define-primordial-class macro, which is like defclass but with less error checking and options. Near the end of clos.lisp, many normal functions are replaced with generic functions, once we have implemented generic functions themselves.
In summary: Any Java-only analysis of abcl's structure will find an interlinked set of instances of StandardClass + some subclasses thereof; lots of the interesting stuff happens Lisp-side, where the aforementioned StandardClass instances implement classes like method-combination, standard-accessor-method, generic-function, etc. Also, UML does Java/Smalltalk-style OO best and didn't really play well with generic functions and multimethods last time I looked; I don't know if that has changed.
More information about the armedbear-devel