I remember the first time I ever tried Squeak all those years ago, this was the first thing that bit me - not being able to declare temporary variables within the blocks that use them. I was so used to doing that from VisualAge.
So, I vote in favour of the change :-)
My own preference is a balance between being readable and efficient.
At first, i care above anything to make my code readable.
And I think that, being properly formatted, declaring temps in blocks
scope not makes code less readable.
Also, i think that keeping variables close to desired scope, will
instead could help improving code readability.
But i must say, we should learn & teach developers to write code short
& consise, or at least attempt to (following a well known smalltalk
practice - 1/2 lines per method).
Then we wouldn't need to choose, what way of declaring temps is better ;)
2010/1/4 St�phane Ducasse <stephane.ducasse@inria.fr>:
--> Hi guys
>
> in squeak a week ago nicolas pushed a cool (from my taste) changes that refactored the complete
> system so that |temp| declaration would be at the scope where they are used.
> This is not clear that this is an optimisation but I like the fact that temp
> are defined at the right place.
> Now it may lead to code that is a bit less readable in the sense that your temps
> are not systematically listed at the beginning of the method but occasionally in the closures
> that use them.
> From my hackish lisping state of mind I like it now what do you prefer?
>
> Stef
> _______________________________________________
> Pharo-project mailing list
> Pharo-project@lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
Best regards,
Igor Stasenko AKA sig.
_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project