ted basically 

> Dog class>>newWhite
>  "Returns a new white instance of receiver."
>  ^self new 
>    color: Color white;
>    yourself


is equivalent to 

> Dog class>>newWhite
>        "Returns a new white instance of receiver.”

>       | instance |
          instance := self new.
          instance color: Color white;
> 
>        ^ instance


So this is really when you do not know what a subclass may do with 
reimplementing color: 
so yourself make sure that your extenders can be doing crazy things, your job 
is good. 

S. 


> On 2 Aug 2020, at 19:55, tbrunz <wild.id...@gmail.com> wrote:
> 
> Got it.  Seems like an important point for those who are trying to understand
> the difference between instances and classes.  
> 
> I've gotten strange results myself until I learned that #yourself is an
> essential thing...
> 
> -t
> 
> 
> 
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
> 

--------------------------------------------
Stéphane Ducasse
http://stephane.ducasse.free.fr / http://www.pharo.org 
03 59 35 87 52
Assistant: Aurore Dalle 
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley, 
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France

Reply via email to