Newbie q

Scott Wallace scott.wallace at squeakland.org
Fri Sep 26 20:31:08 UTC 2003


At 2:52 PM +0200 9/26/03, Matej Kosik wrote:
>
>   StringMorph>>fontToUse
>
>whose name should certainly be
>
>   StringMorph>>font
>
>(but that is not the point of the discussion)
>
>I do not like it. The trivial method which should do nothing more
>but return the value of the appropriate instance variable is spoiled
>by some superfluous stuff.


This method is inappropriate to the lazy-initialization discussion 
for two reasons:

(1) The selector is not the name of any instance variable, so why 
should the method be criticized for not consisting only of a simple 
inst-var retrieval?

(2) The method does not do lazy initialization of any instance variable.

The point of #fontToUse (and the reason it is not named #font) is 
that it is *not* an instance-variable accessor, but rather a method 
that constructs an "effective font to use" by considering both the 
"font" and the "emphasis" instance variables of the StringMorph.

If the method selector here had indeed been #font, *and° if the code 
of the method had indeed done lazy initialization of the "font" 
instance variable, then it might have been a reasonable example of 
the issue in question ;-)


Cheers,

    -- Scott



More information about the Squeak-dev mailing list