Re: PHP 4.0 Bug #8428 Updated: continue doesn't pass thru a switch statement

From: Date: Mon, 08 Jan 2001 15:54:57 +0000
Subject: Re: PHP 4.0 Bug #8428 Updated: continue doesn't pass thru a switch statement
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-43391@lists.php.net to get a copy of this message
On Mon, 8 Jan 2001, Stanislav Malyshev wrote: > SV>> And in C it doesn't, that is, it continues the loop enclosing the switch. > SV>> I think we should have behavior similar to C here, anything else would be > SV>> confusing. The C behavior is more useful too I think. > > I think C behaviour is most confusing (which is no wonder given how many > confusing behaviours C has). Why "break" works on switch and its brother > "continue" works on enclosing loop? Oh, just because C makers were short > on words and constantly used same keywords to represent different > things? Not good enough. The C behaviour may be confusing, but it's been out there for 20+ years. IMHO, if PHP borrows syntax from C that looks identical, it should act identical. And, I'd claim it's particularly important /because/ many people think the C spec is confusing. It's hard enough memorizing odd language behavior, you don't want to remember that C works one way and PHP the other. Just as PHP tries very hard not to break backwards compatibility with old PHP syntax that doesn't seem proper, I'd say this is breaking compatibility with C syntax, which pre-dates the PHP. Now, PHP isn't C, but if you're going to borrow from C, it should be done cleanly and exactly, or completely differently; otherwise, they'll just be confusion. One of the most annoying things to me is that the associativity of ?: is /backwards/ when compared to C. Talk about a subtle bug waiting to slip in. Who would think to check this? The last thing one assumes is that the parser is incorrect? Unfortunately, it was agreed not to make this change due to legacy reasons. Maybe we'll make the same evaluation here, but I'd prefer that it's admitted as a "bug" not as a "feature." :) -adam -- / adam maccabee trachtenberg | visit college life online \ \ adam@student.net | http://www.student.com /

« previous php.dev (#43391) next »