> What lexical scope should $x be _implicitly_ declared in?  Maybe, just
> maybe, we need a my $x at the top to tell us it is outside the scope of the
> first reference.  Otherwise we get three different lexical variables, and an
> undefined value warning at run time.

You're right, great point. There's a lot of details implicit in the
email I sent out, which would have to be worked out.

For example, one solution might be that the default lexical scope is
only delimited on function boundaries:

   # all these are in the same scope
   $x = 2;
   if ( $x ) {
      $y = $x;
   } else {
      $y = 5;
   } 
   print "y = $y\n";    # 2

   sub compute {
       ($x, $y) = @_;   # but these aren't
   }

Remember, though, my() remains for use, so if you wanted to partition it
off, you could:

   # separate scopes via my()
   $x = 2;
   if ( $x ) {
      my $y = $x;
   } else {
      my $y = 5;
   } 
   print "y = $y\n";    # compile error for $y


I don't intend this to be accepted without a knock-down, drag-out fight
(if at all). However, rather than just set pragmas to different values,
my point is that we shoule re-examine what the goal is, and our
assumptions.

-Nate

Reply via email to