Nathan Wiger <[EMAIL PROTECTED]> writes:
>>   I have retained the title of "Lexical variables made default,"
>> because I still feel that that is the primary purpose of this change
>
>First off, I think this is a great idea in principle. However, I don't
>think it goes nearly far enough in the implementation. I'd like to
>propose something radical.
>
>Consider code like this, which is not uncommon:
>
>   use strict;
>   my $var1 = 'some val';
>   my $var2 = 'some other val';
>  
>   sub mysub {
>       my($arg1, $arg2) = @_;
>       (my $result = $arg1) =~ s/some/every/g;
>       return ($result, $arg2);
>   }
>
>   my @stuff = mysub($var1, $var2);
>
>You get the idea. Dang there's a lot of my()'s in there! The only thing
>I see this RFC changing is the need for the "use strict" statement.
>However, the code is still littered with what I would argue are
>"useless" my()'s that serve as workarounds for a fundamental flaw in the
>langauge: all variables are global by default.

Go look at some Tcl/Tk code for what happens if you make everything 
innermost lexical by default.

You get liberal sprinkling of 

  upvar 2 foo 
  global fred harry

etc.

The problem is you quite often whant variables to cross {} boundaries,
if any mention of thing on left declares it in current scope you 
end up with "upvar" and "global" to say "no I don't mean that".

-- 
Nick Ing-Simmons

Reply via email to