On Feb 1, 2004, at 10:31 AM, Brian Mastenbrook wrote:
I'm having a look at the code here, which is also my first time actually looking at what Cocoa code looks like in OpenMCL. I have a few impressions:
- The Cocoa interface seems very well done and very usable
Folks should be aware that there are some caveats about building code with the Cocoa interface. I'm sure that everyone will rapidly run into the problem that, unlike a call to a Lisp function, a call to an Objective C methods cannot be compiled until the class and method referenced are first compiled. This restriction places some awkward limitations on load order, limitations that account for a few peculiarities in how Clotho and other Bosco-based applications are organized.
The general rule of thumb is that you must sort your classes and methods to eliminate forward references in the load. When you can't eliminate forward references you can work around the limitation by interposing a call to a Lisp function instead of a reference to an Objective-C class or method, because you can refer to a Lisp function before it's defined. The Lisp function can then be defined later in the load order, after the Objective C class or method has been defined.
There are several subtleties to using the bridge in its current form. For example, it defines a pseudovariable SELF, which, in Objective C methods refers to the object that owns the method. You cannot return or store the value of SELF and expect to use it; if you want to use it that way you must %COPY-MACPTR it first. I imagine people hacking this code will at first run into a bunch of gotchas like this. I'll be happy to help out wherever problems involve things I've already figured out. If Duncan has gotten McCLIM code drawing in Cocoa windows, then he's probably also a good person to ask about some of these problems, as he will have had to solve many of them in order to get that code working.
- Why is it that the Cocoa interface is internal to package CCL? This
violates my sense of aesthetics :-)
My guess would be because most of Gary's work in in package CCL. :-) I see no reason we couldn't change it and put it in package cocoa (or whatever).
- This seems like an eminently hackable start.
Good; I listed you as a project member in the proposal to common-lisp.net to create a Clotho project. :-)
I'm now mirroring the Clotho 0.1 release at http://cs.indiana.edu/~bmastenb/misc/Clotho%200.1.dmg .
Thanks. I hope to hear soon from other people who want to hack it.