Shouldn't ifEmpty return self?

marcelo Cortez jmdc_marcelo at yahoo.com.ar
Mon Jun 12 19:22:53 UTC 2006


Boris

 you are right, i'm confused with doit method
implemented on the fly into UndefindedObject.

 but False>>ifTrue: aBlock response nil.


False>>ifTrue:aBlock 

ifTrue: alternativeBlock 
	"Since the condition is false, answer the value of
the false alternative, 
	which is nil. Execution does not actually reach here
because the
	expression is compiled in-line."

	^nil
     
       Best regards  
      MDC


 --- Boris Popov <boris at deepcovelabs.com> escribió:

> Umm, no, receiver of a doit should have nothing to
> do with the code being
> executed. Here's a VisualWorks implementation, which
> is more correct given
> the intent of these methods, 
> 
> #(1) ifEmpty: [nil]	#(1)
> #() ifNotEmpty: [nil]	#() 
> 
> Cheers!
> 
> -Boris
> 
> -- 
> +1.604.689.0322
> DeepCove Labs Ltd.
> 4th floor 595 Howe Street
> Vancouver, Canada V6C 2T5
> 
> boris at deepcovelabs.com
> 
> CONFIDENTIALITY NOTICE
> 
> This email is intended only for the persons named in
> the message
> header. Unless otherwise indicated, it contains
> information that is
> private and confidential. If you have received it in
> error, please
> notify the sender and delete the entire message
> including any
> attachments.
> 
> Thank you.
> 
> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org
>
[mailto:squeak-dev-bounces at lists.squeakfoundation.org]
> On Behalf Of marcelo
> Cortez
> Sent: Monday, June 12, 2006 11:49 AM
> To: Ron at USMedRec.com; The general-purpose Squeak
> developers list
> Subject: Re: Shouldn't ifEmpty return self?
> 
> Ron
> 
>  in your example ( with doit)
> 
>    #(1) ifEmpty: [nil]  
> 
>   ifEmpty block don't qualify, so return the
> receiver.
>   the receiver of Doit is UndefinedObject
>   from there you have nil  how result
>  best regards 
>    MDC
>  --- Ron Teitelbaum <Ron at USMedRec.com> escribió:
> 
> > Shouldn't ifEmpty: return self?
> > 
> >  
> > 
> > #(1) ifEmpty: [nil]  ->      Returns nil
> > 
> > #(1) ifNil: [nil].       ->      Returns #(1)
> > 
> >  
> > 
> > Ron Teitelbaum
> > 
> >  
> > 
> > > 
> > 
> 
> 
> __________________________________________________
> Correo Yahoo!
> Espacio para todos tus mensajes, antivirus y
> antispam ¡gratis! 
> ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
> 
> > 
> 


__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar



More information about the Squeak-dev mailing list