[Openmcl-devel] Snow Leopard snafu
R. Matthew Emerson
rme at clozure.com
Tue Sep 1 13:30:36 EDT 2009
On Sep 1, 2009, at 12:59 PM, Ron Garret wrote:
> Oh blarg, this doesn't work either:
> ? (make-instance gui::ns-lisp-string :with-string (coerce "foo"
>> Error: value "foo" is not of the expected type (OR MACPTR NULL).
> So let me just ask: what is the Right Way to convert a Lisp string to
> an NSString nowadays?
There's the (unexported) macro CCL::WITH-AUTORELEASED-NSSTRINGS, that
works like this:
(ccl::with-autoreleased-nsstrings ((s1 "foo") (s2 "bar"))
(#/initWithObjects: (#/alloc ns:ns-array) s1 s2 +null-ptr+))
This is somewhat nicer than fiddling with %MAKE-NSSTRING. (And it's
analogous to macros such as WITH-ENCODED-CSTRS and so forth that are
part of documented CCL.)
I would have exported it, but I'm not sure what package it should go
in, and whether it should really be WITH-CFSTRINGS.
More information about the Openmcl-devel