Any reason for assigning block parameter in inject:into:
Keith Hodges
keith_hodges at yahoo.co.uk
Mon Apr 30 09:04:01 UTC 2007
> Rather it's the confusion of sorting out what's going on in a piece of
> code
> when someone's decided variable names are too much work to invent,
> and reused parameter names for other quantities along the way.
>
> When you're reading a piece of unfamiliar code, every bit of solid
> ground helps;
> knowing that the value of a parameter doesn't change in the course
> of the method makes it that much easier to read and debug.
The particular annoyance that I noticed was when very short methods
which should have been one liners. end up as three of four because of
the need to declare and assign a second variable to represent the same
thing.
I dont think that debugging or readability is made easier by finding
that there are not two, often similar, variable names which reference
the same thing, one of which is immutable the other is not.
Keith
More information about the Squeak-dev
mailing list
|