On Mon, 3 Sep 2001, Brent Dax wrote:
> Now is where the temp() stuff I was talking about earlier comes in.
>
> sub foo {
> my($bar);
> foo();
> }
>
> is basically equivalent to
>
> sub foo {
> temp($MY::bar);
> foo();
> }
Oh, you're pitching softballs to yourself. Try a hard one:
my @numbers;
for (0 .. 10) {
my $num = $_;
push(@numbers, sub { $num });
}
for (0 .. 10) {
local $num = $_;
push(@numbers, sub { $num });
}
print join(', ', map { $_->() } @numbers), "\n";
It's in Perl5, but the analogy to Perl6 should be clear enough. This is a
good example of the different natures of lexical and dynamic variables.
-sam
- Re: Should MY:: be a real symbol table? Nathan Torkington
- RE: Should MY:: be a real symbol table? Brent Dax
- Re: Should MY:: be a real symbol table? Bryan C . Warnock
- Re: Should MY:: be a real symbol table? Dan Sugalski
- RE: Should MY:: be a real symbol table? Dan Sugalski
- Re: Should MY:: be a real symbol table? Ken Fox
- Re: Should MY:: be a real symbol table? Dan Sugalski
- Re: Should MY:: be a real symbol table? Ken Fox
- Re: Should MY:: be a real symbol table? Dan Sugalski
- RE: Should MY:: be a real symbol table? Brent Dax
- RE: Should MY:: be a real symbol table? Sam Tregar
- RE: Should MY:: be a real symbol table? Dan Sugalski
- RE: Should MY:: be a real symbol table? Dave Mitchell
- RE: Should MY:: be a real symbol table? Dan Sugalski
- RE: Should MY:: be a real symbol table? Garrett Goebel
- Re: Should MY:: be a real symbol table? Bart Lateur
- Re: Should MY:: be a real symbol table? Ken Fox
- Re: Should MY:: be a real symbol table? Dan Sugalski
- Re: Should MY:: be a real symbol table? Bart Lateur
- Re: Should MY:: be a real symbol table? Dan Sugalski
