From objective-cl at mail.matthias.benkard.de Wed Mar 5 19:35:16 2008 From: objective-cl at mail.matthias.benkard.de (Matthias Benkard) Date: Wed, 5 Mar 2008 20:35:16 +0100 Subject: [objective-cl-announce] Objective-CL 0.2.0 Message-ID: <8176ee540803051135s43f44acasc803671de68bc583@mail.gmail.com> Hi all, Objective-CL 0.2.0 has been released. This release is a major milestone on the way to 1.0.0. * Quick summary We can now define Objective-C classes and methods without writing a single line of Objective-C code. The API may not be stable and there might be crashes, but living dangerously is half the fun, right? ;) * What's new? ** Method call syntax #.(enable-method-syntax) We now support Clozure CL's new method call syntax via reader macros. That means you can write: (let ((lock (#/new (find-objc-class 'ns-lock)))) (#/lock lock) (print (#/stringWithCString:encoding: (find-objc-class 'ns-string) "Hi there!" 0)) (#/unlock lock)) In fact, as the reader macro does no more than offer an alternate syntax for symbols, you can do things like using it with APPLY as well: (apply #'#/stringWithUTF8String: (find-objc-class 'ns-string) (list "Hi again.")) ** Class definition You can now define classes. For example, the following will define a subclass of NSObject called MLKMyClass, including a native slot called FOOS and a foreign slot (that is, an Objective-C ivar) called FOO-COUNT (fooCount on the Objective-C side): (define-objective-c-class ns::mlk-my-class (ns::ns-object) ((foos :initargs :foos) (foo-count :foreign-type :int))) Simple CFFI type specifiers are recognised by :FOREIGN-TYPE, but please note that complex types such as struct and union types are not yet supported. ** Method definition You can now define Objective-C methods from Lisp for your own classes. The following will define the Objective-C method -(int)foo:(int)bar:(id)stuff:(id)do:(NSNumber *) on MLKMyClass instances: (define-objective-c-generic-function #/foo:bar:stuff:do: (self y z a b)) (define-objective-c-method #/foo:bar:stuff:do: :int ((self ns::mlk-my-class) (y :int) z a (b ns::ns-number)) (format t "Hello! Z and A are ~A and~&~A, respectively. Have a nice day." z a) (+ y 20)) Usage example: OBJECTIVE-CL> (invoke (invoke (find-objc-class 'mlk-my-class) 'new) :foo 3 :bar "abc" :stuff 3 :do 33) Hello! Z and A are # and #, respectively. Have a nice day. 23 Note that, at present, you absolutely have to call DEFINE-OBJECTIVE-C-GENERIC-FUNCTION before defining methods, because otherwise you're going to get the wrong type of generic function. All modifiers of the standard method combination should be supported in principle, but it's unlikey they'll work as expected. This is planned for a future release. &REST and &KEY arguments are not supported. #.(disable-method-syntax) ** Struct wrappers When an Objective-C method returns a struct, it is now wrapped in a FOREIGN-STRUCT; likewise for unions. If you want to prevent its automatic deallocation, you need to set its FOREIGN-VALUE-LISP-MANAGED-P property to false. This change has been made because it would otherwise not be safe to discard return values of Objective-C methods, a safety which both Objective-C and Lisp programmers have come to expect. ** COLLECT-CLASSES The new function COLLECT-CLASSES may be used to make all classes known to the Objective-C runtime available as CLOS classes under the NS namespace. In an ideal world, we'd do this automatically at system load-time, but registering such a large number of classes along with their metaclasses takes a long time on some CL implementations (CMUCL, SBCL), so it's the user's decision whether to use FIND-OBJC-CLASS for each class or COLLECT-CLASSES once for now. If you try the release out, please tell me what works and what doesn't. If you can't even get it to compile, that is helpful information as well. Of course, above all, have lots of fun! ~ Matthias From objective-cl at mail.matthias.benkard.de Fri Mar 7 12:15:44 2008 From: objective-cl at mail.matthias.benkard.de (Matthias Benkard) Date: Fri, 7 Mar 2008 13:15:44 +0100 Subject: [objective-cl-announce] Objective-CL 0.2.1 Message-ID: <8176ee540803070415k7c149698kceb0be1bbbb091f2@mail.gmail.com> Hi all, I have released Objective-CL 0.2.1. This release adds convenience and robustness to the previous one. * Quick Summary Super calls are supported. Bugs have been fixed. You may omit DEFINE-OBJECTIVE-C-GENERIC-FUNCTION calls. * What's New? ** Super Calls Up to now, there was no way of doing the equivalent of a message send to `super' as in Objective-C. This has changed. Just as with CALL-NEXT-METHOD for standard methods, you may now either call (SUPER) as-is or with the arguments you wish to pass to it. See the SUPER function in the reference manual for details. ** Implicit Definition of Objective-C Generic Functions DEFINE-OBJECTIVE-C-METHOD now takes care of defining a suitable OBJECTIVE-C-GENERIC-FUNCTION for you if you don't do so yourself. ** Bug Fixes Lots of little bugs are gone as well. Among others, returning values from Objective-C methods now works much more reliably, and Lisp wrapper objects don't just vanish when the GC runs as long as the corresponding foreign instance is still referenced by Objective-C code. I'm still wondering what to do on garbage-collected Objective-C runtimes. Have fun! ~ Matthias From objective-cl at mail.matthias.benkard.de Sun Mar 23 17:10:41 2008 From: objective-cl at mail.matthias.benkard.de (Matthias Benkard) Date: Sun, 23 Mar 2008 18:10:41 +0100 Subject: [objective-cl-announce] Objective-CL 0.2.2 Message-ID: <8176ee540803231010v7194ecfegbece5f18f586c4b9@mail.gmail.com> Hi all, I have released Objective-CL 0.2.2. It's primarily a bug fix release. * Quick Summary No dependency on Darcs versions of CFFI. CMUCL can be used again. AMD64 compilation problems have been fixed. Moderate speed improvements for method invocation. * What's New? ** CFFI 0.9.2 Support Objective-CL has always included support code for different CFFI versions, but the support for anything older than a more or less recent Darcs checkout turned out be broken. This release fixes the brokenness, so release versions of CFFI should actually be supported now. ** CMUCL Compatibility As CMUCL does not support closures as funcallable-instance-functions, a workaround had to be implemented. This has been accomplished by compiling a new lambda expression every time a selector is initialised. This, of course, makes (COLLECT-SELECTORS) slower than on other implementations and probably wastes a certain amount of memory, but it works. ** Speed Improvements Method invocation speed has been improved a bit. See the development diary (file JOURNAL) for details. ** AMD64 Compatibility The Objective-C support code from PyObjC used to assume that ssize_t and int are equivalent. One search-and-replace procedure later, Objective-CL compiles on AMD64 GNUstep machines. This new support has not been extensively tested, so it may still be broken in some way or another. Furthermore, a similar procedure has not been applied to the Apple-specific pieces of the PyObjC support code yet Bug reports are welcome. Have fun! ~ Matthias