Shouldn't ifEmpty return self?

Chris Muller chris at funkyobjects.org
Tue Jun 13 19:59:23 UTC 2006


Yes, I had a brief brain lapse there; I actually use ifNil: on a
regular basis and really like the way it works; allows terse code.

--- Joshua Gargus <schwa at fastmail.us> wrote:

> 
> On Mon, 12 Jun 2006 10:29:50 -0700 (PDT), "Chris Muller"
> <chris at funkyobjects.org> said:
> > It would probably be more consistent with ifTrue: and ifFalse: for
> > ifNil: to return nil.
> >
> >   false ifTrue: [ 'non-nil' ]   -> nil
> >
> 
> Perhaps more consistent, but I think less useful.  You couldn't write
> code like:
> 
> self doSomethingWithNonNilObject: (anObject ifNil: [self
> generateNonNilObject])
> 
> 
> Josh
> 
> 
> 
> > Chris
> >
> > --- Ron Teitelbaum <Ron at USMedRec.com> wrote:
> >
> > > Shouldn't ifEmpty: return self?
> > >
> > >
> > >
> > > #(1) ifEmpty: [nil]  ->      Returns nil
> > >
> > > #(1) ifNil: [nil].       ->      Returns #(1)
> > >
> > >
> > >
> > > Ron Teitelbaum
> > >
> > >
> > >
> > > >
> > >
> >
> >
> 
> 




More information about the Squeak-dev mailing list