Forum: Ruby-core [ruby-trunk - Feature #8859][Open] Possibility to declare local varibles like "my" in Perl

098cb310e633c26666368d4095933b4e?d=identicon&s=25 bdimych (Dmitry Bolshakov) (Guest)
on 2013-09-04 07:51
(Received via mailing list)
Issue #8859 has been reported by bdimych (Dmitry Bolshakov).

----------------------------------------
Feature #8859: Possibility to declare local varibles like "my" in Perl
https://bugs.ruby-lang.org/issues/8859

Author: bdimych (Dmitry Bolshakov)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:


Hi
I think it would be useful to have an analogue of the "my" keyword in
Perl
e.g.
x = 'outer value'
p = Proc.new {
  ...
  many code here
  ...
  my x = 'local value does not affect outer variable'
}
I know I can declare local variables in the beginning of the block with
a semicolon |;x|
but imho special keyword would be more handy
0ec4920185b657a03edf01fff96b4e9b?d=identicon&s=25 matz (Yukihiro Matsumoto) (Guest)
on 2013-09-04 13:55
(Received via mailing list)
Issue #8859 has been updated by matz (Yukihiro Matsumoto).

Status changed from Open to Rejected

If you are proposing to introduce 'my' keyword to the language, there's
no chance.
Introducing new keyword can cause compatibility problems, so that it
should be very beneficial.

Otherwise please be concrete.

Matz.


----------------------------------------
Feature #8859: Possibility to declare local varibles like "my" in Perl
https://bugs.ruby-lang.org/issues/8859#change-41610

Author: bdimych (Dmitry Bolshakov)
Status: Rejected
Priority: Normal
Assignee:
Category:
Target version:


Hi
I think it would be useful to have an analogue of the "my" keyword in
Perl
e.g.
x = 'outer value'
p = Proc.new {
  ...
  many code here
  ...
  my x = 'local value does not affect outer variable'
}
I know I can declare local variables in the beginning of the block with
a semicolon |;x|
but imho special keyword would be more handy
This topic is locked and can not be replied to.