[#863] RDtool-0.5.0 — Toshiro Kuwabara <toshirok@...3.so-net.ne.jp>

Hi,

18 messages 1999/10/23
[#864] Re: RDtool-0.5.0 — matz@... (Yukihiro Matsumoto) 1999/10/26

Hi,

[ruby-talk:00881] Re: local / dynamic variables

From: gotoken@... (GOTO Kentaro)
Date: 1999-10-29 21:13:40 UTC
List: ruby-talk #881
Hi, 

In message "[ruby-talk:00879] local / dynamic variables"
    on 99/10/29, Clemens Hintze <c.hintze@gmx.net> writes:

>>  This is probably a stupid question, but why in a block a variable is not
>>  always dynamic when this variable is defined between | |  ?
>
>This, I don't know for sure, but I assume, that the variables between
>| | are not local ones, but denote that these ones are used to serve
>as block parameters!
>
>Every variable created within a block, is local to the block; means
>not known outside. If the variable between | | is created in the
>block, it serves as parameter *and* is local to it!
>
>So, I guess, | | is not a sign for locallity. Only for parameter denoting.

Great! This explanation is easy to see :-)

However, I feel a small weak point; This explanation cannot be in
common with the case of a method definition, that is, 
arg of "def foo(arg)" is shielded from outer scope but |x| doesn't. 
Of course, it may be a small thing. 

-- gotoken

In This Thread