develooper Front page | perl.perl5.porters | Postings from November 2016

Re: are lexical subs supposed to override keywords?

Thread Previous
November 14, 2016 19:39
Re: are lexical subs supposed to override keywords?
Message ID:
On 14 November 2016 at 18:09, Father Chrysostomos <> wrote:
> On Nov 14, 2016, at 1:29 AM, Dave Mitchell <> wrote:
>> It surprised me that perl keywords are overridden by lexical sub names.
>> Is this intentional? I couldn't find anything in perlsub about it.
>>    my sub for { print "in lex sub (@_) \n" }
>>    for (1,2);
>> outputs
>>    in lex sub (1 2)
> That is wholly intentional.  It is similar to how a lexical @INC overrides the global @INC.  The core keywords could all be thought of as being in a namespace that gets searched by default before the current package.  Lexical symbols always take precedence over other namespaces.

Am I correct in thinking that implies we need less features to add new syntax?


perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About