[cl-objc-devel] CLOS interface

Luigi Panzeri matley at muppetslab.org
Fri Sep 7 12:56:51 UTC 2007


Hi,

I just uploaded on my darcs repository
(http://www.innerloop.it/~matley/cl-objc-soc) a patch with the initial
support of a CLOS interface to ObjC. Basically it associates to every
objc class a clos class (of a custom metaclass), and to every method a
clos method and a related generic function (of a custom metaclass),
such that the user can code:

(objc:int-value (objc:init-with-int? (make-instance 'objc:ns-number) 10))

This feature is not enabled by default, because the import process of
classes and (mainly) methods is really time-consuming for either the
Foundation or Cocoa frameworks. It can be enabled using
#'objc-clos:update-clos-definitions or setting
objc-clos:*automatic-clos-definition-update* before using
define-objc-framework.

At the moment the code is sbcl specific, but i used only the protocol
defined in the AMOP. So using the library closer-to-mop the code can
be portable among the most common cl implementations.

I tried also a lazy approach, defining just generic functions and
defining the methods when needed, specializing on
sb-mop:compute-applicable-methods and
sb-mop:compute-applicable-methods-using-classes but this approach
doesn't work as expected. Sometimes these functions are not called,
due to caching mechanism present in the dispatch of generic functions
(i tried with the last sbcl).

I think i have to put more effort on this problem. Other features to
implement on my TODO list are:

* class methods in the clos interface (what is a class method and an
  ObjC metaclass in the CLOS perspective?)

* Exceptions management (i have to study what the functions in
  /usr/include/objc/objc-exception.h do)

* Protocols management

Refactoring, documentation and profiling (i don't understand why
compiling a cl-objc example is so slow)

Best regards

-- 
Luigi Panzeri aka Matley

Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film
Quotes on Lisp: http://lispers.org/



More information about the Cl-objc-devel mailing list