[gambit-list] Problem with interactive development using remote REPL of iOS Sim.

mikel evins mevins at me.com
Fri Mar 1 03:33:11 EST 2013


On Feb 27, 2013, at 9:50 AM, mikel evins <mevins at me.com> wrote:

> For a Lispier version, you could look at CCL's FFI, which is quite comprehensive, and which provides a lot of very nice conveniences for writing code that talks to Cocoa. For example:
> 
> (defclass converter (ns:ns-object)
>   ()
>   (:metaclass ns:+ns-object))
> 
> (objc:defmethod (#/convertCurrency:atRate: :float) 
>     ((self converter) (currency :float) (rate :float))
>   (* currency rate))
> 
> 

I think it's worth mentioning a couple of things that are made possible by the CCL FFI, and that Gambit users might want to consider. 

With CCL's FFI you can make Lisp classes whose superclasses are Objective-C classes. You can write Lisp methods for Objective-C functions (or, rather, "messages"). You can create instances of Objective-C classes some of whose instance variables are Lisp values, and vice-versa: instances of Lisp classes, some of whose slots are Objective-C values. As shown in the example, you can call Objective-C methods directly, and you can refer to Objective-C variables and constants directly.

Again, almost all of the infrastructure is generated automatically, using ffigen together with parsers written in Lisp.






More information about the Gambit-list mailing list