Hi Luca, On Thu, 9 May 2013 12:15:00 +0200 Luca Ferrari <fluca1...@infinito.it> wrote:
> Hi, > the usage of "my" to scope variables is a good habit, and under > "strict" is almost a need. But just today I realized that having to > write "my" in front of each block of variables does not seem to me a > perl-ish way of doing things: it requires extra effort to a quite > simple task (variable declaration). Is there any ongoing effort to > make "my" the default behavior (for example in Perl 6, that I'm > totally unaware of)? There isn't. The alternative to my is called "implicit scoping", where variables spring to use upon first use, and is present as such languages as http://en.wikipedia.org/wiki/Python_%28programming_language%29 , http://en.wikipedia.org/wiki/Ruby_%28programming_language%29 and http://en.wikipedia.org/wiki/CoffeeScript , and introduces many subtle scoping bugs (it bit me in Ruby at least twice, and also at least twice in Python), and as such is not considered a good idea. "my" is one of the shortest possible ways to declare variables anyway. See: https://news.ycombinator.com/item?id=2864317 (not my link). Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Stop Using MSIE - http://www.shlomifish.org/no-ie/ Chuck Norris wrote a complete Perl 6 implementation in a day, but then destroyed all evidence with his bare hands, so no‐one will know his secrets. — http://www.shlomifish.org/humour/bits/facts/Chuck-Norris/ Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/