[Openmcl-devel] Specifying data types for calls via the Obj-C bridge with a variable number of arguments

Gary Byers gb at clozure.com
Fri Apr 27 23:37:00 PDT 2007



On Sat, 28 Apr 2007, Phil wrote:

> Ah... thanks!  Am I correct in assuming you meant (objc:send (objc:@class 
> "NSString") :string-with-format #@"Testing: %@" (:id "one two three four")) 
> as an example of using a Lisp string?  (i.e. it appears to work but seems a 
> little weird as %@ is used in the format string.)
>
> Thanks,
> Phil


No, I meant to say (:id #@"one two three four").

SEND does some coercion of lisp strings to NSStrings, but I'm not
sure that it does so in the case of non-fixed arguments, and I'm not
sure that it's a good idea (who releases that consed-up NSString and
when does this happen ?  In the case of a string constant, does
the ability to sometimes skip the #@ buy you much in terms of
readability ?)

"%@" in an ObjC format string basically means "use the printable
representation of the next arg, which should be an ObjC object."
#@"one, two, three, four" is an ObjC object ...



More information about the Openmcl-devel mailing list