[Openmcl-devel] Cocoa - small question about send
alexcrain at mail2.widgetworks.com
Mon Nov 8 01:25:39 UTC 2004
You're very close. You want
(ccl:send (find-clss 'ns:ns-bundle) 'main-bundle)
Keyword arguments must have an an actual argument, so if you're sending
a message that
doesn't take an argument, you just quote it.
You have the same problem when you declare new methods, so while
terminate looks like this:
(define-objc-method ((:void :terminate sender)
(declare (ignore sender))
The init method doesn't take an argument and you would code it like
(define-objc-method ((::void init)
:init-with-name #@"lisp exception"
:reason #@"lisp exception"
Notice that init is not a keyword.
On Nov 7, 2004, at 5:56 PM, Dan Knapp wrote:
> In order to better understand the Cocoa bridge, I'm trying to write
> small in it. Specifically, I want to figure out how exactly an
> interface defined in
> a Nib is loaded and used by Lisp code. I've been reading the example
> and making some headway.
> In the course of doing this, I wanted to access the application
> bundle, which
> is done with the objc method "mainBundle". I eventually got that
> CL-USER> (ccl::send (find-class 'ns:ns-bundle) "mainBundle")
> #<NS-BUNDLE NSBundle </Applications/openmcl/ccl/OpenMCL.app> (loaded)
> It seems, though, as if my first attempt should have been correct:
> CL-USER> (ccl::send (find-class 'ns:ns-bundle) :main-bundle)
> Improperly formatted argument list: (:MAIN-BUNDLE)
> [Condition of type SIMPLE-ERROR]
> 0: [ABORT] Abort handling SLIME request.
> 1: [ABORT-BREAK] Reset this process
> 2: [ABORT] Kill this process
> 0: (CCL::%PARSE-MESSAGE ':MAIN-BUNDLE)
> 1: (CCL::MAKE-OPTIMIZED-SEND '(FIND-CLASS 'NS:NS-BUNDLE)
> ':MAIN-BUNDLE 'NIL 'NIL 'NIL 'NIL #<CCL::DESTRUCTURE-STATE
> 2: (CCL::SEND '(CCL::SEND (FIND-CLASS 'NS:NS-BUNDLE) :MAIN-BUNDLE)
> 3: (FUNCALL #<Compiled-function CCL::SEND Macroexpander #x659FD4E>)
> 4: (MACROEXPAND-1 '(CCL::SEND (FIND-CLASS 'NS:NS-BUNDLE)
> :MAIN-BUNDLE) 'CCL::SEND)
> 5: (CCL::CHEAP-EVAL-IN-ENVIRONMENT #<STRING-INPUT-STREAM #x71CF8BE>
> '(CCL::SEND (FIND-CLASS 'NS:NS-BUNDLE) :MAIN-BUNDLE))
> 6: (SWANK::EVAL-REGION "(ccl::send (find-class 'ns:ns-bundle)
> [... rest deleted ...]
> Is this a bug in parse-message? Or is there something I'm not
> -- Dan Knapp
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 3049 bytes
Desc: not available
More information about the Openmcl-devel