develooper Front page | perl.perl5.porters | Postings from June 2013

[perl #117535] Bogus "Ambiguous use of * resolved as operator *" warning

Father Chrysostomos via RT
June 27, 2013 01:12
[perl #117535] Bogus "Ambiguous use of * resolved as operator *" warning
Message ID:
On Mon Apr 08 10:46:01 2013, nicholas wrote:
> I'm recording this bug mostly for completeness, not because I expect
> it to be
> fixed. The code in question is not really something that has any right
> to
> parse, let alone be useful.
> $ perl -lwe '$* = \*STDERR; print $*foo'
> $* is no longer supported at -e line 1.
> Bareword found where operator expected at -e line 1, near "$*foo"
>         (Missing operator before foo?)
> Unquoted string "foo" may clash with future reserved word at -e line
> 1.
> Operator or semicolon missing before *foo at -e line 1.
> Ambiguous use of * resolved as operator * at -e line 1.
> foo
> and the exit code is 0.
> Note that 3 of the 4 warnings from the parser are actually bogus, but
> the
> last is utterly incorrect, as there is no multiplication operator
> anywhere
> be seen.

The ambiguity warning actually turns out to be very easy to fix.  I have
done so in commit 9700e2d.

The ‘Bareword found where operator expected’ I have not touched, even
though I think it is incorrect in some cases.  It has to do with the
value of PL_expect, which affects the way indirect objects are parsed.

Making even minuscule changes in that area is likely to break things
like this:

$ ./perl -Ilib -MO=Deparse -e 'print $FOO + $x'
print $FOO + $x;
-e syntax OK
$ ./perl -Ilib -MO=Deparse -e 'print $FOO +$x'
print $FOO $x;
-e syntax OK
$ ./perl -Ilib -MO=Deparse -e 'print $FOO+$x'
print $FOO + $x;
-e syntax OK

So I think we should just leave it.


Father Chrysostomos

via perlbug:  queue: perl5 status: open Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About