<div dir="ltr"><div>I think the &#39;where do you stop&#39; question is easily answered.&nbsp; You stop when you can&#39;t achieve agreement.&nbsp; </div>
<div>&nbsp;</div>
<div>I think we are quite close to agreement in ifNil: and ifNotNil: and far from agreement on other if.. and ifNot... constructs.&nbsp; Further, ifNotNil: with a monadic block as its argument does provide a unique &#39;convenience&#39; function that has been discussed previously.&nbsp; </div>

<div>&nbsp;</div>
<div>I can see&nbsp;similar value in a whileNotNil: message (with a monadic block), but I think added this construct likely falls on the far side of the &#39;where do you stop&#39; line -- at least right now.</div>
<div>&nbsp;</div>
<div>I also agree that is... (as in isEmpty) should be the standard pattern for messages that answer a boolean while if... (as in ifNil: [])&nbsp;should be&nbsp;the standard pattern for messaged that evaluate a block based on a boolean.</div>

<div><br clear="all">John O&#39;Keefe [|], Principal Smalltalk Architect, Instantiations Inc.<br><br><br></div>
<div class="gmail_quote">On Wed, Sep 3, 2008 at 9:57 PM, Richard A. O&#39;Keefe <span dir="ltr">&lt;<a href="mailto:ok@cs.otago.ac.nz">ok@cs.otago.ac.nz</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>&quot;Jim&quot; ( jas at <a href="http://cruzio.com/" target="_blank">cruzio.com</a> ) wrote that he preferred<br>
<br>isNil: a0block<br>notNil: a0block<br>nonNil: a1block<br>and various combinations of those to the by now traditional<br>[ifNil:][ifNotNil:]<br><br>As a Smalltalk user, it&#39;s quite important to me that methods<br>taking a block that might or might not be evaluated have<br>
&quot;if&quot; in the keyword selector for that block.<br><br>For example, it&#39;s<br>&nbsp; aCollection at: someKey ifAbsent: exceptionBlock<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^^<br>ifAbsent:, not isAbsent:, notPresent:, nonPresent:, or<br>
anything else.<br><br>There seem to be three reasons for leaving [ifNil:][ifNotNil:]<br>out:<br>(1) No agreement about the optional argument in the not-nil<br>&nbsp; block; of course the standard could cover just the no-<br>&nbsp; argument case.<br>
(2) These methods aren&#39;t really necessary unless you have<br>&nbsp; redefined what nil == ... does. &nbsp;A compiler can turn<br>&nbsp; &nbsp; &nbsp; &nbsp;nil == (expr) ifTrue: b1 ifFalse: b2<br>&nbsp; into whatever<br>&nbsp; &nbsp; &nbsp; (expr) ifNil: b1 ifNotNil: b2<br>
&nbsp; does.<br>(3) Where do you stop? &nbsp;Once you have these, why not<br>&nbsp; b1 while[Not]Nil[: b2]? &nbsp;Why not ifEmpty:ifNotEmpty:?<br>&nbsp; This is actually a serious question; I&#39;ve wanted<br>&nbsp; b1 whileNotNil: b2 often enough.<br>
<br>On the other hand, the feature is widely available, and is<br>quite intention-revealing, so the answer to (3) is &quot;because<br>these methods _are_ common practice and those aren&#39;t.&quot;<br>--<br>If stupidity were a crime, who&#39;d &#39;scape hanging?<br>
<br><br><br><br><br><br><br><br>_______________________________________________<br>ANSI-Smalltalk mailing list<br><a href="mailto:ANSI-Smalltalk@lists.openskills.org" target="_blank">ANSI-Smalltalk@lists.openskills.org</a><br>
<a href="http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk" target="_blank">http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk</a><br></blockquote></div><br></div>