From: matz@... (Yukihiro Matsumoto) Date: 2000-10-14T23:44:49+09:00 Subject: [ruby-talk:5531] Re: Some newbye question Hi, In message "[ruby-talk:5516] Re: Some newbye question" on 00/10/14, ts writes: |D> You already have a simple and effective way to fix it, simply implement |D> the standard binding rules. | | How do you resolve this ? | |[ruby-talk:5497] |> 2 reasons: |> |> (a) I don't like variable overriding, especially in declaration-less |> language like Ruby. |> |> (b) since blocks were introduced for iteration originally, I want |> any assignables can be block parameters. 3 possible solution in my mind for the future: (1) local variables in the block parameters be valid only in the surrounding block. I think Davide proposed this one. This violates (a), and introduces incompatibility (small?). This is not perfect since the problem remains for non parameter local variables. (2) introduces some kind of explicit local variable declaration, such as `let' (as in Lisp). This violates (a) too, but since declarations are explicit for special cases, this can be acceptable, I think. Small incompatibility. (3) introduces some kind of syntax to make closure, for example proc = lambda(a,b) ... end In addition, there should be way to distinguish local variables local to the closure and local variables shared with outer scope. For most languages, declarations do the job, but I have no idea what is good for Ruby yet. They are still just vague ideas. I think the solution might be the combination of (1)+(2) or (2)+(3). The latter might be better. But I'm not sure whether they are worth it at all. matz.