Shouldn't ifEmpty return self?

Joshua Gargus schwa at fastmail.us
Mon Jun 12 18:52:08 UTC 2006


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