Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102272 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51944 invoked from network); 15 Jun 2018 08:40:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jun 2018 08:40:32 -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.68 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.68 mail-wm0-f68.google.com Received: from [74.125.82.68] ([74.125.82.68:52353] helo=mail-wm0-f68.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 94/D1-29356-F7B732B5 for ; Fri, 15 Jun 2018 04:40:31 -0400 Received: by mail-wm0-f68.google.com with SMTP id p126-v6so2242195wmb.2 for ; Fri, 15 Jun 2018 01:40:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=npkZZX88d62kcUCeEJUw5RV5RV1ZxDy05s7bo5H0wq8=; b=TFyrLXpyiok/tRBOzqUSp6JR8zYHkZ0Jg07B2o980vgQK43K0eeEX80apaX8YLs3Hc lwIgq1TaOqG9KgcRiL9wqsruOCX4qSN/2kS3l8uK9pLGtDFgvVxCR5UEQjQEXS3S/dLG oTi3tYLDEeKQSGdXAwfHsxEKY2Q/8xGCW4wiTRmQvQlB3a4HHPOBPJv6fy2g5asfhzOr ib43rrhOeVjQ4LNw6XOGIkOtweFPobS4cRF3K2NiVwcH84VLNRHpucPooEckTnf/+ZPK IkunBuyDTIlL97IgI1BsD+cNFpUIA1PqvHN5e9zBCq13kqYdajx1rDikaFmbMadff9XV aOzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=npkZZX88d62kcUCeEJUw5RV5RV1ZxDy05s7bo5H0wq8=; b=bX6afknSmWLez2j/OhZCPiMFl5G1orUFntDrWmS5uk3wvPgo0XIbNjH8msfiIWJHI9 pdEAcRl5l5rwD2PmGWs96MsmxK2zfqigOrRtH+WdxNiZ7DVxBZC+dkUC/SszNIzrsS5L HPHMd9s4WSuGS1ML8b7niBn2i7TqqPOq6s0SeEmsyZQ4QBkC/oQVST9mkcm50KJuX2j0 w7nkOYxBn7dgKvRcgYclaEmHurq5zXX2IwegDyuV2BkNUedjtcNV7HHFwDr6K5xv/CX0 wkBr5lnhPD7U+i1VoTtOy12bjM0xodj7BZVu/upEfM6oGbmJn9x0U7elSiifqIoWFDW3 1FwA== X-Gm-Message-State: APt69E10dykxSZBJagSQHuvMY3DO3J5iq8e1DHAbpGAs3/KhjwOZheXT TtT3qBTTqeNWXgNS5MFPbm6k80yTXMbXpieCvnI= X-Google-Smtp-Source: ADUXVKJfOMvTTjt6+/LSVh0XO0d10t6hOjkS0DBzxP6VF/7L0COtPTCH4zTqYnFIiM4bdQw1b6HYpX4wKR+y81Gx9Pc= X-Received: by 2002:a50:8143:: with SMTP id 61-v6mr1119969edc.100.1529052028084; Fri, 15 Jun 2018 01:40:28 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a50:8d55:0:0:0:0:0 with HTTP; Fri, 15 Jun 2018 01:40:27 -0700 (PDT) In-Reply-To: References: <20180614155730.2C8BC1A8027C@dd1730.kasserver.com> Date: Fri, 15 Jun 2018 09:40:27 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000fa2842056eaa2af6" Subject: Re: [PHP-DEV] Strict switch statements From: rowan.collins@gmail.com (Rowan Collins) --000000000000fa2842056eaa2af6 Content-Type: text/plain; charset="UTF-8" On 14 June 2018 at 23:15, Stanislav Malyshev wrote: > Hi! > > > Would both be more apparent as to its meaning and leave the door open > > for other uses. Though at that point, tbqh, I think `switch ($a) use > > (===) {...}` gives better visual isolation. > > I don't think we should reuse the use() thing for third purpose when > we're already using it for two. I imagine with new parser logic we > should not be as restricted in syntax choices as we've been before? So > being a bit more explicit than "use(===)", which would be a bit of a > head-scratcher for a casual PHP user. Something like "strict switch" at > least gives a person something to ask about - what is "strict switch" > exactly? But "use(===)" would be harder to read and harder to look up > online. > As I've said before, I think precisely the opposite: === immediately means "strict comparison" to anyone who knows PHP, but "strict switch" could mean any number of restrictions: strict comparisons, no implicit fall-through of cases, no duplicate cases, etc, etc If it's the keyword reuse and punctuation that are an issue, what about just picking a different word, and leaving out the parens: switch ($foo) with === { case 42: blah(); break; case '42': blerg(); break; } Regards, -- Rowan Collins [IMSoP] --000000000000fa2842056eaa2af6--