<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">That's pretty slick, though I have to confess a certain dismay that there seem to be three different conventions for translating lisp symbol names into ObjC method names (corresponding roughly to some-objc-method, #/SomeOBJCMethod, and <s>ome<objcm>ethod.<div><br></div><div>I see in the docs where it describes how to use make-instance to instantiate ObjC classes it says:</div><div><br></div><div>"I<span class="Apple-style-span" style="font-family: Times; font-size: 14px; ">n some special cases, such as loading an ns:ns-window-controller from a .nib file, it may be necessary for you to pass the instance itself as one of the parameters to the initialization method."</span></div><div><font class="Apple-style-span" face="Times" size="4"><span class="Apple-style-span" style="font-size: 14px;"><br></span></font></div><div><font class="Apple-style-span" face="Times" size="4"><span class="Apple-style-span" style="font-size: 14px;">Can you be a little more specific about the circumstances under which these special cases arise?</span></font></div><div><font class="Apple-style-span" face="Times" size="4"><span class="Apple-style-span" style="font-size: 14px;"><br></span></font></div><div><font class="Apple-style-span" face="Times" size="4"><span class="Apple-style-span" style="font-size: 14px;">And as long as I'm asking random ObjC bridge questions, the 1.3 release notes say:</span></font></div><div><br></div><div><span class="Apple-style-span" style="font-family: verdana; font-size: 13px; ">"The Objective-C bridge no longer converts lisp strings to NSString instances automatically."</span></div><div><font class="Apple-style-span" face="verdana" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></div><div><font class="Apple-style-span" face="verdana" size="3"><span class="Apple-style-span" style="font-size: 13px;">Why not? I thought that was a handy feature. Is it a memory management issue?</span></font></div><div><font class="Apple-style-span" face="verdana" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></div><div><font class="Apple-style-span" face="verdana" size="3"><span class="Apple-style-span" style="font-size: 13px;">rg</span></font></div><div><br><div><div>On May 28, 2009, at 12:15 AM, Gary Byers wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br><br>On Thu, 28 May 2009, R. Matthew Emerson wrote:<br><br><blockquote type="cite"><br></blockquote><blockquote type="cite">On May 28, 2009, at 2:06 AM, Ron Garret wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">It turns out that I've been forgetting to #/init things all over the<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">place but things still mostly work for me. Am I just getting lucky?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Should #/init always be called when #/alloc is called?<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Yes, either #/init or some more specific initializer, e.g. #/<br></blockquote><blockquote type="cite">initWithFrame:, etc.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">There's also the #/new method, which combines #/alloc and #/init into<br></blockquote><blockquote type="cite">one, but using it is apparently not considered stylish any more.<br></blockquote><br>I personally consider MAKE-INSTANCE to be at least somewhat stylish.<br><br>(MAKE-INSTANCE class) == (#/new class) == (#/init (#/alloc class))<br><br>(MAKE-INSTANCE class {:with-pseudo-initarg-keyword value}+)<br><br>uses the provided set of keywords to construct an #/init... function<br>name (there's some caching involved ...) and does<br><br>(#/thatInitFunction: (#/alloc class) ,@values)<br><br>It's not as high-level as it might look - a set of keywords that map<br>to an init function name have to all be present and present in the<br>canonical order for this to work - but things like:<br><br>(make-instance window-class<br> :with-content-rect rect<br> :style-mask style-mask<br> :backing backing-type<br> :defer nil)<br><br>may (or may not) look more readable than:<br><br>(#/initWithContentRect:styleMask:backing:defer: (#/alloc window-class)<br> rect<br> style-mask<br> backing-type<br> nil)<br><br><br>though (modulo typos) the two forms should have equivalent effect.<br><br><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite"> If not, how do<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">you know when you need to call #/init? (Feel free to treat those as<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">rhetorical questions. I'm sure there's a Cocoa memory management<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">primer somewhere that I can go read.)<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><<a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/CocoaObjects.html#/">http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/CocoaObjects.html#/</a>/apple_ref/doc/uid/TP40002974-CH4-SW17<br></blockquote><blockquote type="cite">><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">Openmcl-devel mailing list<br></blockquote><blockquote type="cite"><a href="mailto:Openmcl-devel@clozure.com">Openmcl-devel@clozure.com</a><br></blockquote><blockquote type="cite"><a href="http://clozure.com/mailman/listinfo/openmcl-devel">http://clozure.com/mailman/listinfo/openmcl-devel</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote></div></blockquote></div><br></div></body></html>