Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100513 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48202 invoked from network); 10 Sep 2017 20:36:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Sep 2017 20:36:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.67 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.67 mail-wm0-f67.google.com Received: from [74.125.82.67] ([74.125.82.67:36204] helo=mail-wm0-f67.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 07/F2-10715-132A5B95 for ; Sun, 10 Sep 2017 16:36:02 -0400 Received: by mail-wm0-f67.google.com with SMTP id p17so5398391wmd.3 for ; Sun, 10 Sep 2017 13:36:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=/uWazpFxRTpR7jVF19xiM6EUOAowZOVJk2ScqphpPmY=; b=qYXRsFv9XbfbDxxclj+hiKcWy11I80i747fe/0OLnhSRIrBIddwtfSuWyMbTP6ezeg eR46azUme9dqhcoWYmYuTz62Sk1S8XFNgocX9u+TlEgAbIe1+j+7X9W6WS4w0t+0snwu yjYDNxL3J1gJeDVrY8erEKh2GMd+rosexKOGbpWaw+7AkB4dw3zq1YDgXRTW23YAEp+X vhLRIeQzJKbgc1La/sLo86+yAqK6eCwv3egHkId+jscWcXYc8qScoHs21WVPfHKM+3fw rKOh9/SDtybcuz2fTDLgQwIoHrttuR4bxEbFcsYwlFeoMMKPAtH/5fcaE7YUVLvljXPW JhhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=/uWazpFxRTpR7jVF19xiM6EUOAowZOVJk2ScqphpPmY=; b=ftgSd404nQYLhNjqi7tkSZ25wymUwdIpGNb08CCzWewRkeKeoyvD9/yfb2W5YlbqFz prka9Z/wvWd1xOxqhfN/uhHQzB2nG1rj/A97Mi1K84c46IHCWl+pLDDIbs6ifX2huEHO wm5eSq6Gi0s/9h9fXqfOtH+U5dJiUNpf1rmCPn9Ek8Ryy8g486XVvRULfFFqxzDnG/Oe 9rurbG00KIsv3vrw5ecin7umuh9CZW78Ri0aOT4aFLPg1AllzUxFH+T5zCUIXOGhtQy2 MYQzIoncgeDIrOGAH5rHn6fmET68eenCWS9wecZMhGP4YlATjYKcO1+PW3ZjC4VRsnWN CW4Q== X-Gm-Message-State: AHPjjUgp2jvZdCK3wrFxAbgeotflF1SkZ4GGd0ev1lfCkXrqnqdRKeil Fp0S/oyAbOkbBGJu X-Google-Smtp-Source: AOwi7QDIOLQ2UA6P/yihaRsIUahdOF+Vg9oDhBWsX/Gs4etwYJaBiDNKhO4H8xpq8T06Ah61RxdYGQ== X-Received: by 10.28.203.4 with SMTP id b4mr111596wmg.17.1505075757842; Sun, 10 Sep 2017 13:35:57 -0700 (PDT) Received: from ?IPv6:2a00:23c4:4b81:ae00:dce6:5a6f:e286:564b? ([2a00:23c4:4b81:ae00:dce6:5a6f:e286:564b]) by smtp.googlemail.com with ESMTPSA id f188sm9606171wme.21.2017.09.10.13.35.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Sep 2017 13:35:56 -0700 (PDT) To: internals@lists.php.net References: <044d6dc6-63b4-5242-b910-f5a4fdf48eab@rhsoft.net> <66a056cc-87f6-3f5e-0417-6b8ab51cdbae@rhsoft.net> Message-ID: Date: Sun, 10 Sep 2017 21:35:55 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <66a056cc-87f6-3f5e-0417-6b8ab51cdbae@rhsoft.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Match expression From: rowan.collins@gmail.com (Rowan Collins) On 10/09/2017 20:35, lists@rhsoft.net wrote: > the whole switch discussion is broken by design > with " raise an error if cases are mixed (case 'a' and case 1 under the same switch) It's interesting that the behaviour you think is obvious is completely different to what I think of: if the author of the code has put both case 42 and case '42' in the switch statement, the "strict" interpretation in my mind would be that both branches are reachable, as though tested with an "===" operator (whereas currently the second would never be selected, because no value =='42' that doesn't also ==42). > and also raise an error in a case like below when $a is anything else then int I guess this explains the different direction you're coming from: what you want could perhaps be termed a "strongly typed switch statement", where both input and case values are checked as soon as possible for being of some specified type. The logical syntax for that would probably be an explicit type in the switch statement somewhere, like this: switch(int $a) { case 1: ..; break; case 2: ..; break; } Although an obvious question would be why switch gets such a version, and what other language constructs should follow suit. Regards, -- Rowan Collins [IMSoP]