Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76479 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30185 invoked from network); 13 Aug 2014 12:45:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Aug 2014 12:45:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.178 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.216.178 mail-qc0-f178.google.com Received: from [209.85.216.178] ([209.85.216.178:45108] helo=mail-qc0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 93/53-11625-5DD5BE35 for ; Wed, 13 Aug 2014 08:45:09 -0400 Received: by mail-qc0-f178.google.com with SMTP id x3so3970164qcv.23 for ; Wed, 13 Aug 2014 05:45:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=bD+O2UffcMSG18tzG1Th5lShp4nWGGZW/OaTkNDY9h4=; b=W33WwEyn7b62UaEwlv7TyeFz2TKR4k0ySlADnmjdYflgpgqCvE7xTuQroNGnRFwElN iD4F52/rOpxf6HnXEk6izbpOePLDMXv2hmZ0RL89JrSsK68up23jqBE5FuRrJEk3q2uo XBSUaYl4b38NX9uxfuiZD7gRtqW9KKQx8CZBxQEhVaM4gm+Gn/Vu9CR+ufhTZnqlVKXg JfwyBSKvtP//Y1H+OgON37sFWrv8smZ0iw1IiOhf+EfS9PSzd9kt4ak8qG5jXjbtlyve ur4B1gD5QCau5mkFyIXMwrxBONiLElr/FIKuUTz4npKFiIxgtNlJeyje1N068n2x4jLY 2mkQ== MIME-Version: 1.0 X-Received: by 10.140.92.13 with SMTP id a13mr6135126qge.88.1407933952130; Wed, 13 Aug 2014 05:45:52 -0700 (PDT) Received: by 10.140.102.111 with HTTP; Wed, 13 Aug 2014 05:45:52 -0700 (PDT) In-Reply-To: References: <53EB3C6A.5010106@gmail.com> <53EB59AD.6020100@gmail.com> Date: Wed, 13 Aug 2014 14:45:52 +0200 Message-ID: To: Rowan Collins Cc: PHP Internals Content-Type: multipart/alternative; boundary=001a113987201585f20500822b90 Subject: Re: [PHP-DEV] [RFC] Disallow multiple default blocks in a single switch statement From: tyra3l@gmail.com (Ferenc Kovacs) --001a113987201585f20500822b90 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Aug 13, 2014 at 2:42 PM, Ferenc Kovacs wrote: > > > > On Wed, Aug 13, 2014 at 2:27 PM, Rowan Collins > wrote: > >> Ferenc Kovacs wrote (on 13/08/2014): >> >>> agree, and I thought about mentioning that, but I left that out, becaus= e >>> I'm not proposing to remove that ability (and I see more use-cases for = that >>> as mentioned in my previous email) but stating that this patch would ma= ke >>> an arbitrary distinction between the normal and the default cases. >>> >> >> I'm not sure I agree that it's arbitrary. Having a switch with two >> "default" clauses is like having an if with two "else" clauses; specifyi= ng >> two case labels which can be true at the same time is like having two >> "elseif" clauses chained together that can both be true at the same time= . >> One is clearly an error; the other is just poorly written logic, and you >> can't make the parser outlaw every instance of poor logic. > > > > Default is more of a catch all directive than an else (which will only > match if nothing else), so I don't think that having two default is more > "wrong" than having two "case 2:". > > -- > Ferenc Kov=C3=A1cs > @Tyr43l - http://tyrael.hu > Btw. I've added a comment to https://bugs.php.net/bug.php?id=3D67757 as I'v= e found some really weird behavior for multiple defaults and I think that it would be better to try to figure out and fix why do we pick the last default in the problematic snippet instead of trying to remove the multiple default support to get rid of the setup which can make this bug to surface. --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --001a113987201585f20500822b90--