On Tue, 1 Jul 2003 10:30:34 -0400, [EMAIL PROTECTED] wrote:
>On Tue, Jul 01, 2003 at 05:15:09PM +0300, Vladi Belperchinov-Shabanski wrote:
>>   my $id = 1 if $_ == 3;
>This was an accidental feature that is now kept for backwards
>compatibility, because some programmers have used it to create static
>variables.  It's best to avoid it, however.

As others have observed, it doesn't really make static variables since
a new pad will be used for each level of recursion.  I also think that
with multiple ithreads, each thread will use a different pad.

I don't think it was kept for backwards compatibility; I think it just
would be very difficult to make it work otherwise, though Dave
Mitchell and Gurusamy Sarathy have discussed[1] doing so (with,
surprisingly, no objections).  The problem with keeping it is that
people keep stumbling across it accidentally.

[1] http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2003-03/msg00019.html

Reply via email to