develooper Front page | perl.perl5.porters | Postings from July 2009

Re: "Keyword" labels now forbidden (was [perl.git] branch blead, updated. GitLive-blead-1705-gf71d615)

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
July 29, 2009 23:19
Subject:
Re: "Keyword" labels now forbidden (was [perl.git] branch blead, updated. GitLive-blead-1705-gf71d615)
Message ID:
b77c1dce0907292319n4e24b8d3i70a9a85c190c2e3c@mail.gmail.com
2009/7/30 David Nicol <davidnicol@gmail.com>:
>>>    Forbid labels with keyword names
>>
>> Interesting.  This "broke" one of my CPAN modules.  Wonder how many
>> others it will affect?
>
>
> Why? I've always considered the fact that you can generally use
> keywords as other things in Perl to be a good thing.
>
> $ perl -le 'goto: $x++ > 3 and die 1; print $x; goto goto'
> 1
> goto must have label at -e line 1.

This error is about the second goto.

> $ perl -le 'goto: $x++ > 3 and die 1; print $x; goto "goto"'
> 1
> 2
> 3
> 4
> 1 at -e line 1.
>
> it's already a synbtax error when it makes no sense.  What's the harm?

No it's not :

$ perl -e 'goto print'
Can't find label 1 at -e line 1.

Thread Previous | 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