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

Lexical subs allow overriding if/else & other syntax keywords?

Thread Next
From:
Brian Fraser
Date:
March 24, 2013 19:52
Subject:
Lexical subs allow overriding if/else & other syntax keywords?
Message ID:
CA+nL+nYJyzsBjrMUm2zspyp5LoPoxUT-X3_k_kyPT5qRdOYkQg@mail.gmail.com
This might be a bug:

$ ./perl -M-warnings -Ilib -Mfeature=lexical_subs -E 'my sub else (&)
{ say "woah, what?"} if (1) {} else {}'
woah, what?

As there's no way of getting that override with normal subs. However,
similar behavior is tested for in lexsub.t, so this looks intended?

Since lexical subs are experimental I don't think is needs to be
addressed right away, but it certainly looks icky.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About