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
Inconsistent behaviour of 'while ()' and 'until ()' #8283
Comments
From j.nurick@mvps.orgCreated by j.nurick@mvps.orgThis is a bug report for perl from j.nurick@mvps.org, ----------------------------------------------------------------- 'while ()' behaves like 'while (1)', but 'until ()' won't compile. STEPS TO REPRODUCE > perl -e "use warnings; while () {$x++; print $x; last if $x==9; }" > perl -e "use warnings; until () {$x++; print $x; last if $x==9; }" COMMENT After discovering this I asked in clpm where it was documented. Having 'until ()' behave like 'until (1)' would be useless as the block Might it also bring a special little TMTOWTDI pleasure if 'while ()' and Perl Info
|
From charles.e.derykus@boeing.com
And, perversely, this produces no syntax error (5.6.1, 5.8.7): perl -wle 'do {$x++; print $x; exit if $x==9 } until ()' -- |
The RT System itself - Status changed from 'new' to 'open' |
From @ysthOn Tue, Jan 17, 2006 at 07:11:32AM -0800, DeRykus, Charles E wrote:
That's different, and parallel to this (which also works): perl -wle 'until ( () ) {$x++; print $x; exit if $x==9 }' |
From charles.e.derykus@boeing.com
Ah, you're right. I had forgotten that is different. But, if 'until ()' is special cased to have 'while ()' semantics, I'll bet someone will ask why 'for ()' differs and must be 'for (;;)' :) -- |
From j.nurick@mvps.org
IMHO that takes 'until ()' well into bug territory. No syntax error in 5.8.4, BTW. John |
From j.nurick@mvps.org----- Original Message -----
I'll admit the thought had crossed my mind<g>. But as long as Perl has 'for John |
From zefram@fysh.org"while()" parallels "for(;;)", for which the behaviour of omitting Postfix "until ()" being legal is not a bug, but a perfectly regular This ticket should be closed. -zefram |
@iabyn - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#38254 (status was 'rejected')
Searchable as RT38254$
The text was updated successfully, but these errors were encountered: