<div>Hello!</div><div><br></div>I am starting to really get into Objective-C (looking forward to <a href="http://clang.llvm.org/docs/ObjectiveCLiterals.html">http://clang.llvm.org/docs/ObjectiveCLiterals.html</a>). I recently ported Underscore.js to Objective-C (<a href="https://github.com/kmalakoff/_.m">https://github.com/kmalakoff/_.m</a>) and had one problem that I couldn't resolve...how to put up a compiler warning for nil termination on blocks.<div>
<br></div><div>Typically, Apple does something like this:</div><div><br></div><div>
<p class="p1"> + (<span class="s1">id</span>)arrayWithObjects:(<span class="s1">id</span>)firstObj, ... <span class="s2">NS_REQUIRES_NIL_TERMINATION</span>;</p></div><div><br></div><div>but I need to do something like this:</div>
<div><br></div><div>
<p class="p1"> + (<span class="s1">A</span>*(^)(<span class="s1">NSA</span>* array, <span class="s1">NSA</span>* array1, ... <span class="s2">NS_REQUIRES_NIL_TERMINATION </span>))intersection; // (A is NSMutableArray, NSA is NSArray)</p>
<p class="p1"><br></p></div><div>I played around with combinations of __attribute__((sentinel)) , but nothing produced the correct compiler-time warnings. Is there a way to do this now? Do I need to submit a request to a standards body? Is there already an implementation in the works? Questions, questions.<div>
<br></div><div><br></div></div><div><br></div><div>Also, I am looking for someone to help me optimize and push my port of Underscore.js in Objective.C (I'm nowhere near guru level to do thorough benchmarking and optimizations). If you are interested in pitching in, please let me know!</div>
<div><br></div><div>Kevin</div><div><br></div><div><a href="https://github.com/kmalakoff">https://github.com/kmalakoff</a></div>