On Thu, Jul 11, 2002 at 03:18:27PM -0400, Dan Sugalski wrote:
> At 7:35 PM +0100 7/11/02, Dave Mitchell wrote:
> >On Thu, Jul 11, 2002 at 02:29:08PM -0400, Dan Sugalski wrote:
> >> At 7:18 PM +0100 7/11/02, Dave Mitchell wrote:
> >> >On Thu, Jul 11, 2002 at 10:41:20AM -0400, Dan Sugalski wrote:
> >> >>  The place where you'll run into problems in where you have multiple
> >> >>  variables of the same name at the same level, which you can do in
> >> >>  perl 5.
> >> >
> >> >can it?
> >>
> >> Yes.
> >>
> >> >can you give an example?
> >>
> >> [localhost:~] dan% perl
> >> my $foo = 12;
> >> print $foo;
> >> my $foo = "ho";
> >> print $foo;
> >> 12ho[localhost:~] dan%
> >
> >ah, I see what you mean. I hope that'll be a syntax error rather than just
> >a warning in perl6.
> 
> Me too, since it makes pulling lexicals out by name rather tricky. 
> Doable, but tricky. (And messy, and somewhat expensive) That's 
> Larry's call, though.

Is there any specific case where you can't treat

{
  my $foo = 12;
  print $foo;
  my $foo = "ho";
  print $foo;
}

as

{
  my $foo = 12;
  print $foo;
  {
    my $foo = "ho";
    print $foo;
  }
}

(where my outer {}s may just be the scope represented by the beginning and end
of the file)
ie implicitly start a new block just before any duplicate my, which continues
until the point the current block ends.

Nicholas Clark
-- 
Even better than the real thing:        http://nms-cgi.sourceforge.net/

Reply via email to