Luke Palmer fretted:

> This is terrible.  Calling foo which calls bar mysteriously overwrites 
> $date?  "Why is $date changing?" the programmer asks.  He does an 
> exhaustive search through his code and finally says "ohhhhhh," and has to 
> change all references to the inner $date to something like $mydate.
> 
> This is obviously a problem (unless I misunderstood how hypotheticals 
> change their surrounding scope).  For a solution, let's just look how we 
> do it in subroutines.
> 
> my $date;
> sub foo {
>     my $date = 'Jul 17, 1984';
>     # ...
> }
> 
> Oh. Duh. Why don't we have such a mechanism for matches?
> 
>     m/ my $date := <date> /
> 
> is ambiguous to the eyes.  But I think it's necessary to have a lexical 
> scoping mechanism for matches, as to avoid the problem I addressed above. 
> Any ideas?

Yep. Allison and I have two rather nice solutions to this problem, and as soon
as we run them by Larry, and get his agreement on one or both of them,
I'll describe them here in detail.

Rest assured that we see the problem, and we're working on a solution -- or
perhaps two -- that will satisfy everyone's concerns in this area (or, at
least, make everybody equally unhappy ;-)

Damian


Reply via email to