From: gotoken@... (GOTO Kentaro) Date: 2001-03-09T02:10:55+09:00 Subject: [ruby-talk:12284] Re: FEATURE REQUEST: 'my' local variables In message "[ruby-talk:12250] Re: FEATURE REQUEST: 'my' local variables" on 01/03/08, Leo Razoumov writes: > GK> "my" seems too complex for user. > >I do not understand why "my" is too complex to a user. It has been in Perl for >years and no one complained of its complexity. Similar semantics exists in >Scheme and Lisp (let (...)) and has been in use for decades . >If you do not like token "my" it can be any other name like "local", etc. >Bottom line, Ruby does not have a mechanism to push an arbitrary >local variable onto its local scope. And this is bad! I have other opinion. Ruby has scope-indicating variable name, i.e. $foo for global, foo for local. And every definition statement (e.g, "def", "class" etc) makes a new scope. "my" is very useful in a language, which tends to make its scope global, e.g, Perl, Scheme or Lisp, indeed. "my" is powerful. But "my" seems too powerful at least for Ruby. With using "my", one could easily make code complex. This is what I thought. Btw, I agree that the scope rule for "do-end" is comlicated a little. In Shugo's diary, he shows a surprising example: 1.times do id = 0 end p id But it is a different topic, maybe. -- Gotoken