<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Dec 12, 2007, at 5:13 PM, Chris Lattner wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><br><div><div>On Dec 12, 2007, at 5:11 PM, Steve Naroff wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div><div style="color: rgb(0, 0, 221); "><span class="Apple-style-span" style="color: rgb(0, 0, 221); ">Please split it into two functions, where one calls the other.  instead of "lookupInstanceMethod" how about getinstanceMethodBySelector() or something?  Wow that name is long ;-)</span></div><div style="color: rgb(0, 0, 221); "><br style="color: rgb(0, 0, 221); "></div><div><br class="webkit-block-placeholder"></div>I understand what you looking for...I'll consider this approach and make a proposal. </div><br class="Apple-interchange-newline"></span></blockquote></div><br><div>Ok, thanks!</div><div><br class="khtml-block-placeholder"></div></div></blockquote><div><br class="webkit-block-placeholder"></div>Chris,</div><div><br class="webkit-block-placeholder"></div><div>Here is what is currently in TOT...</div><div><br class="webkit-block-placeholder"></div><div>The following 2 methods are implemented on ObjcInterfaceDecl, ObjcCategoryDecl, and ObjcProtocolDecl.</div><div><br class="webkit-block-placeholder"></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(0, 116, 0); "><span style="color: #000000">  </span>// Get the local instance method declared in this interface.</div>
<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">  <span style="color: #3f6e74">ObjcMethodDecl</span> *getInstanceMethodForSelector(<span style="color: #3f6e74">Selector</span> &<span style="color: #3f6e74">Sel</span>);</div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(0, 116, 0); "><span style="color: #000000">  </span>// Get the local class method declared in this interface.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">  <span style="color: #3f6e74">ObjcMethodDecl</span> *getClassMethodForSelector(<span style="color: #3f6e74">Selector</span> &<span style="color: #3f6e74">Sel</span>);</div><div><br class="webkit-block-placeholder"></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "><div>Even though the names are "long", it is much shorter than the corresponding iterator (which the above replaces:-)</div><div><br class="webkit-block-placeholder"></div><div>The more elaborate lookup methods still exist. I added the comment below (ignore the typo, which I will fix:-).</div><div><br class="webkit-block-placeholder"></div></span></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(0, 116, 0); "><span style="color: #000000">  </span>// Lookup the instance method. First, we search locally. If a method isn't</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(0, 116, 0); "><span style="color: #000000">  </span>// found, we look through the reference protocols. Lastly, we look categories</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(0, 116, 0); "><span style="color: #000000">  </span>// defined for this class.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">  <span style="color: #3f6e74">ObjcMethodDecl</span> *lookupInstanceMethod(<span style="color: #3f6e74">Selector</span> &<span style="color: #3f6e74">Sel</span>);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">  <span style="color: #3f6e74">ObjcMethodDecl</span> *lookupClassMethod(<span style="color: #3f6e74">Selector</span> &<span style="color: #3f6e74">Sel</span>);</div><div><br class="webkit-block-placeholder"></div>
</div>
</span></font></div>
</div><div><div>One question...</div><div><br class="webkit-block-placeholder"></div><div>To make these API's a bit more uniform, do you prefer I drop the "ForSelector" from getInstanceMethodForSelector() or add a "ForSelector" to lookupInstanceMethod()?</div><div><br class="webkit-block-placeholder"></div><div>Personally, I would vote for getInstanceMethod/lookupInstanceMethod. With C++ style naming, I don't see the benefit of naming the argument. If we were using ObjC, it would have more value (since all arguments are typically named).</div><div><br class="webkit-block-placeholder"></div><div>Nevertheless, I don't feel strongly about this. </div><div><br class="webkit-block-placeholder"></div><div>Please advise,</div><div><br class="webkit-block-placeholder"></div><div>snaroff</div><div><br class="webkit-block-placeholder"></div><blockquote type="cite"><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><div>-Chris</div></div></blockquote></div><br></body></html>