Hi,

In message "Re: Specifying local and external block parameters (that old chestnut)"
    on 02/10/04, Mauricio Fern?ndez <batsman.geo / yahoo.com> writes:

|>   * if ":=" assignee is already defined in outer scope, it should be
|>     warned (no -w needed, probably), and outer variable is shadowed
|>     hereafter.
|
|Then there must be a way to turn these warnings off, because shadowing
|outer scope variables would be quite common IMHO.

I'm afraid I won't give you a way to turn it off.  It is "quite
common" in other languages, but it does not mean Ruby must follow.
I believe local variable shadowing is a bad thing.

|>   * all local variables in block parameters (e.g. var in |var|) should
|>     be treated as if they are assigned by ":=".  other types of
|>     variables in block parameter should be warned.
|
|What about Hal's
|  0.upto(99) {|frame.scroll| sleep 0.1}
|example?
|
|Accessors would have to be treated differently (introduces a "special
|case" in the language).

If you read the rule again, you will find the answer.  Accessors are
not local variables, so that they will not be treated by ":=" anyway.
Instead, since they are "other types of variables", you will be warned.

|Just the thought of such a 'bondage-and-discipline" language could
|sicken more than one Rubyist :) The "utterly dynamic" vs. "so static
|it's useless" contrast would be too much.
|
|:= does change the appearance more than the admittedly more restricted
|':' prefix solution.

I'm not sure if I get your point.  It will surely change the
appearance. But it changes less than the "<var> solution".

|As you say, it also breaks code, which "':' to indicate local" doesn't.

Yes.  But I feel "':' to indicate local" is ugly.  Many (or most)
people want their block parameters "local to the block".  But "':' to
indicate local" requires additional mark for common case.  "':' to
indicate *external*" is better in this sense, but this also breaks
existing code.

							matz.