<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Yes, because of the dual purpose of this method; 1) to ensure presence of an element and, 2) answer whether the element already existed, </div></div></blockquote><div><br></div></span><div>to be pedantic, answer if the element didn't already exist</div></div></div></div></blockquote><div><br></div><div>Yes, #addNewElement: answers whether it was a new element.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>there isn't a clear and concise name which conveys the full nuance.  It's one of those methods which requires an initial look at the comment and/or code until one is familiar with it.</div></div></blockquote><div><br></div></span><div>Given that addNewElement: doesn't convey the full nuance that's not a valid criticism of the other alternatives, is it ;-)</div></div></div></div></blockquote><div><br></div><div>Well, I think it sort of does.  The word "add" means its compatible with the Set's existing "add" -- we know it means it'll end up in the Set.  That part of the name is stable.  Then there's that word, "New", which is the part which conveys the special nature of the method.</div><div><br></div><div>We could either stick with that, find a new word, or use more than one word.  But I think more words may not add clarity or save one from needing to check the method implementation.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I considered those names, too.  I didn't care for addIfAbsent: for the reason you stated.  I don't care for ifAbsentAdd: because it's backward with other "Absent" nomenclature in the API.<br></div><div><br></div><div>And, I didn't go with #ifMissingAdd: because it confuses the return value with the linguistic semantics -- e.g., if it returns true, does that mean it was "absent" or that it was added?  forcing me to look at the method implementation again anyway.</div><div><br></div><div>#addNewElement: fits in with the #add... nomenclature part of the API, being like a "command" to the object, to which it may answer, "no" (false), if the element already existed.</div><div><br></div><div>It seems the only initial confusion you had was whether it signaled an Exception or not, but I see no other name that avoids the user needing to look at the implementation at least the first time.</div></div></blockquote><div><br></div></span><div>No.  The selector implies it might. The selector is bad because this does not add a new element, it ensures an element is present, </div></div></div></div></blockquote><div><br></div><div>It is consistent with Set>>#add:.  I did consider #ensureNewElement:, but that suffers from the implication you mention (that it might signal an Exception) even more.  To me, the #add... prefix puts it in the same neighborhood with the various Set>>#add: methods, and behaves accordingly.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>and answers if it was added.</div></div></div></div></blockquote><div><br></div><div>Well, it answers if it was, indeed, a "New" element.</div><div>  </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>Therefore, I think #addNewElement: is a good name.</div></div></blockquote><div><br></div></span><div>I beg to differ.  I find it misleading :-(  Which is a shame because it's really useful.  How about trying to reach consensus on a less misleading name?</div></div></div></div></blockquote><div><br></div><div>Sure.  I'm not beholden to the name, but I don't know of a better one that's both perfectly clear AND concise.</div><div><br></div><div>Best,</div><div>  Chris</div></div></div></div>