-
Notifications
You must be signed in to change notification settings - Fork 562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate label does not produce a syntax error. #16579
Comments
From @philiprbrenanSubject: Duplicate label does not produce a syntax error. This is a bug report for perl from philiprbrenan@gmail.com, #!/usr/bin/perl =pod =head1 Duplicate label does not produce a syntax error. The program above compiles and runs successfully yet the goto is ambiguous. =cut Flags: Site configuration information for perl 5.22.1: Configured by Debian Project at Thu Apr 5 12:48:47 UTC 2018. Summary of my perl5 (revision 5 version 22 subversion 1) configuration: Platform: Locally applied patches: @INC for perl 5.22.1: Environment for perl 5.22.1: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/phil/Android/sdk/tools/:/home/phil/Android/sdk/platform-tools/:/home/phil/.local/bin:/home/phil/Android/sdk/tools/:/home/phil/Android/sdk/platform-tools/:/home/phil/.local/bin |
From @iabynOn Tue, Jun 05, 2018 at 01:30:36PM -0700, Philip R Brenan (via RT) wrote:
The behaviour of 'goto LABEL' is arcane, but the code above is legal and In an ideal world, duplicate statements would have been banned, but its |
The RT System itself - Status changed from 'new' to 'open' |
From @iabynOn Tue, Jun 19, 2018 at 09:45:58AM +0100, Dave Mitchell wrote:
Thinking further, a more ambiguous case is would be { I think the goto docs should explain better how it searches for labels. Here's an example of where having the same label twice in the same scope { FOO: for (...) { -- |
From @TuxOn Tue, 05 Jun 2018 13:30:36 -0700, "Philip R Brenan \(via RT\)" <perlbug-followup@perl.org> wrote:
It's not a bug, but a widely used feature. Maybe it could be an *optional* (default *OFF*) warnings category, as SKIP: { ok (foo (), $test_name); TODO: { ok (foo (), $test_name); -- |
From @karenetheridgeOn Fri, 29 Jun 2018 03:47:04 -0700, hmbrand wrote:
This is a really good point. Only allowing one TODO or SKIP block per test file (or even just in the same scope) would cause lots of breakage. However, I agree with the reporter that duplicate labels can be a confusing source of errors, and in some situations can be inferred to be accidental. Perhaps the best way to detect and report this is with a Perl::Critic policy? |
From @demerphqOn Wed, 20 Jun 2018, 03:46 Dave Mitchell, <davem@iabyn.com> wrote:
Loop labels and statement labels are distinct afaiui, you can't goto a loop Yves |
From @demerphqOn Wed, 4 Jul 2018, 10:21 demerphq, <demerphq@gmail.com> wrote:
And, no. I'm wrong. Pebcak. Yves |
From [email protected]On Wed, Jul 4, 2018 at 4:21 PM, demerphq <demerphq@gmail.com> wrote:
Huh? Did you try it? ;-) ... 'cause you made me do it: C:\Users\ebh\Documents>perl -E "$i=0; FOO: for (0..2) { say qq($i (loop C:\Users\ebh\Documents> Eirik |
From @demerphqOn Wed, 4 Jul 2018 at 16:38, Eirik Berg Hanssen
Yeah, i did. In some code I was working on recently and "it didn't Yves -- |
Is this closable? I don't see anything to do here |
No consensus emerged to the effect that a duplicate label ought to produce a syntax error. Closing now. |
@iabyn did suggest above that "I think the goto docs should explain better how it searches for labels" for certain ambiguous cases. Not sure if that's enough to warrant keeping the ticket open. |
I'd like it to be kept open |
What would it take to close it then? |
On Mon, Apr 18, 2022 at 08:52:30AM -0700, Karl Williamson wrote:
What would it take to close it then?
Properly documenting how perl searches for labels in a got, next, etc.
…--
Art is anything that has a label (especially if the label is "untitled 1")
|
Migrated from rt.perl.org#133249 (status was 'open')
Searchable as RT133249$
The text was updated successfully, but these errors were encountered: