[Openmcl-devel] rules for string to NSstring conversions
R. Matthew Emerson
rme at clozure.com
Tue Dec 16 13:08:36 PST 2008
On Dec 15, 2008, at 10:47 AM, Alexander Repenning wrote:
> Anyway, here is just something that appears to be inconsistent. Two
> implementations of MCL-like standard alert dialog. The first one can
> handle lisp string to NSstring coercion just fine (i.e., "bla" turn
> into a constant NSstring and nil turns into a Objective-c null
> pointer) whereas the second implementation based on the
> "alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat
> " function which also takes NSstring parameters, cannot handle lisp
> strings or nil. What is the rule for automatic conversion to work?
> The only obvious difference I can see is that
> alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat
> is a class method but why would that be relevant?
This isn't answering your question, but I want to mention that the
trunk version of CCL doesn't support automatic coercion of lisp
strings to NSStrings.
Please see http://trac.clozure.com/openmcl/ticket/133
If you've got a lisp string in some-string, you can use (#/autorelease
(%make-nsstring some-string)) when providing NSString parameters.
I think that we may want to add a WITH-NSSTRINGS (or WITH-CFSTRINGS
maybe?) macro which would be analogous to WITH-CSTRS.
More information about the Openmcl-devel
mailing list