Any reason for assigning block parameter in inject:into:

Lukas Renggli renggli at gmail.com
Sun Apr 29 09:36:16 UTC 2007


> There's absolutely no way that assigning to a block arg should be
> permitted. Blocks arg should be treated the same as method parameters
> by the compiler.

A question: Why shouldn't it be allowed to assign to method and block
arguments, if the underlying implementation allows to do so?

I wonder, because in other languages like JavaScript it is a very
common pattern to assign to function arguments, for example to set
default values if necessary. Personally I find this more clear and
less error prone than to introduce new temporary variables for the
arguments:

	start: function (element, speed, duration, after) {
		element = $(element);
		speed = speed || 0.4;
		duration = duration || 4.0;
		after = after || function () { return true; };
		...

Cheers,
Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch



More information about the Squeak-dev mailing list