>>>>> "GK" == GOTO Kentaro <gotoken / math.sci.hokudai.ac.jp> writes:
GK> In message "[ruby-talk:12204] FEATURE REQUEST: 'my' local variables"
GK> on 01/03/07, Leo Razoumov <see_signature / 127.0.0.1> writes:
>> # PROPOSED FEATURE:
>> x = 0 #line_1
>> {
>> my x = 7 # new varible 'x' shadowing 'x' from line_1
>> x # -> 7
>> }
>> x # -> 0
>>
>>
>> I guess it should not be hard to add this functionality to the language.
>> Any thoughts?
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!
-- Leo [slonika AT yahoo DOT com]