At 01:45 PM 9/5/2001 +0100, Dave Mitchell wrote:
>can I just clarify something about delete:
>
>my $x = 1;
>{
>     my $x = 2;
>     delete $MY::{'$x'};
>     print $x;
>     $mysub = sub {$x};
>}
>
>print $mysub->();
>
>People seem agreed that print $x should do the equivalent of
>         throw "lexical '$x' no longer in scope"

There might be less agreement than you might think. I wouldn't consider it 
unreasonable to search outward until I found a $x. (Perhaps going so far as 
to find a global if there were no lexical $x around)

>rather than printing 1, but what should print $mysub->() do?

Whatever inside would do, either throwing the error or walking out. I can 
see either way.

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to