[squeak-dev] The Trunk: Environments-cmm.38.mcz

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Tue Dec 24 00:22:41 UTC 2013


2013/12/24 Chris Muller <asqueaker at gmail.com>

> > No there are already different ways to initialize.
> > For example, take the collections, some of them #initialize: not
> #initialize
> > in order to pass a size (or capacity) to the initializer.
> > So the pattern used by Colin is pretty common in Squeak.
> > I invoked the case of Point more for the fact it sends basicNew instead
> of
> > new, than for the names.
>
> The only reason Point sends basicNew instead of new is for
> performance.  Morphic applications create millions of Point instances
> and so an exception is made to avoid the extra send, nothing more.
>
>
That's more or less the same of what I earlier said: you do not want
instance variables to be initialized twice.
It's considered an anti-pattern for two reasons
1) useless waste if CPU cycles
2) useless trouble for who wants to understand how the class works (think
of debugging)


> > There are indeed two different things on the table
> > 1) to have a single initializer
> > 2) the names chosen for initialization
> >
> > Chris, the name count, you can't rename initialize -> set and declare
> this
> > is not a setter, it's quite surrealist and make me think of
>
> You think the "set" prefix makes it a setter?  Even though no
> Smalltalker prefixes their setters with "set" and also it sets
> multiple variables and also is categorized under "initialize-release"
> instead of "accessing"?
>
> That is three differences from what we think of as a "setter".  But
> you say something that is different in 3 ways is "surreal" to call it
> something else..   You need to refine your pattern language!   :)
>
>
Chris, the 3 arguments setter was added afterward.
The 1st method you modified and that made all of us react was setPrefix:
If it does not quake enough like a setter, then what does? Be fair.

I agree that a Smalltalk-centric setter would be named prefix: in our
tradition.
But if you look a bit wider around us, setters are just named set (java C++
python whatever...).
So initializePrefix: is a clear disambiguation now that Smalltalk is not
alone in its world.
And IMO, classification is a hint, but is not enough.



> > http://en.wikipedia.org/wiki/The_Treachery_of_Images ;)
> >
> > I suggest we concentrate on 1) - the single initializer pattern.
>
> But let's concentrate on this one as I suggested :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20131224/b3566266/attachment.htm


More information about the Squeak-dev mailing list