Tom Christiansen wrote:
> 
> >Tom Christiansen wrote:
> >>
> >> >Anything else? Any opinion on whether eval "" should do what it does
> >> >now, and be invisible for the purposes of this analysis; or if it should
> >> >be assumed to instead both use and initialize all visible variables? The
> >> >former produces more spurious warnings, the latter misses many errors.
> >>
> >> You have to assume eval STRING can do anything.
> >>
> >> --tom
> 
> >"have to"? Perl5 doesn't.
> 
> You mean "perl".
> 
> >% perl -we '$x = 3; $v = "x"; eval "\$$v++"'
> >Name "main::x" used only once: possible typo at -e line 1.
> 
> Non sequitur.  And no, I don't have time.

It is relevant in that perl's existing behavior has proven to be useful
even though the implementation is not correct. The correct
implementation would not have issued the above warning, because an
eval"" was present in the code. However, the correct implementation
would also fail to warn in many legitimate cases. The current heuristic
seems to strike a pretty good balance:

% perl -le '$x = 3; eval "\$x++"'
(no warning issued)

Reply via email to