In message "[ruby-talk:12204] FEATURE REQUEST: 'my' local variables"
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?
"my" seems too complex for user.
But I think some shadowing mechanism for an instance variable is
helpful because we have to choose carefully name of an instance
variable when we define a subclass with new features. If name
collision is occur, the super class's functions would not work.
-- Gotoken