Shouldn't ifEmpty return self?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
21 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Shouldn't ifEmpty return self?

Chris Muller
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 <[hidden email]> wrote:

>
> On Mon, 12 Jun 2006 10:29:50 -0700 (PDT), "Chris Muller"
> <[hidden email]> 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 <[hidden email]> wrote:
> >
> > > Shouldn't ifEmpty: return self?
> > >
> > >
> > >
> > > #(1) ifEmpty: [nil]  ->      Returns nil
> > >
> > > #(1) ifNil: [nil].       ->      Returns #(1)
> > >
> > >
> > >
> > > Ron Teitelbaum
> > >
> > >
> > >
> > > >
> > >
> >
> >
>
>


12