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

Frank Shearar frank.shearar at gmail.com
Fri Dec 20 21:01:45 UTC 2013


On 20 December 2013 20:42,  <commits at source.squeak.org> wrote:
> Chris Muller uploaded a new version of Environments to project The Trunk:
> http://source.squeak.org/trunk/Environments-cmm.37.mcz
>
> ==================== Summary ====================
>
> Name: Environments-cmm.37
> Author: cmm
> Time: 20 December 2013, 2:42:33.974 pm
> UUID: c2e36521-ef29-4aa3-9425-84793a2d007c
> Ancestors: Environments-nice.36
>
> Minor cleanups while trying to learn Environments.
>
> =============== Diff against Environments-nice.36 ===============
>
> Item was changed:
>   ----- Method: AddPrefixNamePolicy class>>prefix: (in category 'as yet unclassified') -----
> + prefix: aString
> +       ^ self new
> +                setPrefix: aString ;
> +                yourself!
> - prefix: aString
> -       ^ self basicNew initializeWithPrefix: aString!

Why make the AddPrefixNamePolicy mutable? That seems like a bad idea.
Unless there's some seriously major gain to be had, we should _not_
add setters. The "basicNew initializeWithFoo:" idiom makes it clear
that "AddPrefixNamePolicy new" will not result in a properly
initialised object. It avoids giving people the impression that it's
OK to monkey with the object's state. It's also the closest we can get
to immutability, given that the only way we can initialise an object's
state correctly is by sending it messages. (I realise the idiom's not
in SBPP, but sometimes we can improve on the classics.)

I like how you renamed lots of parameters to indicate the kind of
things they ought to contain ("aNamespace" -> "aDictionary"), but
please, no setters.

frank


More information about the Squeak-dev mailing list