[Openmcl-devel] ObjC callbacks - self and dynamic extent

alex crain alexcrain at mail.widgetworks.com
Thu Feb 10 21:00:40 UTC 2005


This doesn't work...

? (defvar *x* nil)
*X*
? (define-objc-method ((:void my-method sender) my-class)
     (setq *x* sender))
|-[MyClass myMethod:]|
? *x*
#<BOGUS object @ #xCE63E>
?

Not what I had in mind. I gather from reading the lisp kernel code that 
sender is
dereferenced off the stack, my question is how to get it off without 
copying the object.
I can to some hackery like this (for NSDocuments)

(send (send (send self 'window-controllers) :object-at-index 0) 
'document)

Which works, but I can't believe that there isn't an easier way.

Clues?

:alex




More information about the Openmcl-devel mailing list