Local variables & blocks

Hi,

···

In message “Re: Local variables & blocks” on 03/02/03, ahoward ahoward@fsl.noaa.gov writes:

On Sun, 2 Feb 2003, Yukihiro Matsumoto wrote:

I agree with you. I was insane when I designed this rule. That’s why I
propose the change. But I don’t think we can just drop block local
variables like yours, since we have Proc (some kind of anonymous function),
we need some kind of local variables of their own.

insane? i don’t think so to me this is natural as in Cs

Insane for languages like Ruby which do not have explicit declaration.

						matz.

Hi,

I wonder how you’d design scoping rules for Ruby if you could start
from scratch. Would it be like the proposed solution or something
different?

I’d made it as I proposed this time, I think. The current design is
awfully influenced by the past design. When I designed block
parameters and block local variables, I thought:

  • block parameters were different form of “for” iteration variables,
    so that they should accept any kind of variables (locals, globals,
    instance variables, attributes, array slice, etc).

  • thread and proc (lambda) required block local variables, but Ruby
    did not have declaration of local variables, and I didn’t want to
    add it to the language. So I enhanced “assignment as implicit
    declaration” rule.

    					matz.
    
···

In message “Re: Local variables & blocks” on 03/02/03, “Pit Capitain” pit@capitain.de writes: