Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100511 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45376 invoked from network); 10 Sep 2017 20:18:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Sep 2017 20:18:36 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.174 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.128.174 mail-wr0-f174.google.com Received: from [209.85.128.174] ([209.85.128.174:35328] helo=mail-wr0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7C/62-10715-B1E95B95 for ; Sun, 10 Sep 2017 16:18:36 -0400 Received: by mail-wr0-f174.google.com with SMTP id m18so11139191wrm.2 for ; Sun, 10 Sep 2017 13:18:35 -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=M5ACa8ocM+qERyHoUSAUwyRANREJ0gPDKqJ0/RXjXLY=; b=plHLzCvL5K6giqsVYVHn3Gj8ERtXhp/nNr0wZDIp2yXkESPdoaf0PqrYXJAYfxAIGJ LHoX9w3yz9O1J7Jl3VsfThlz9ivFlJfyaFJLSAlr8+/I6YyGN8LUtYBtXqfsLtq7qVUA jxmuteXA8zw6kcDFfjNGD88XAs9IzFXir4jNyjrkp8wQkZKzKs4am4Yb6vTvNthlUPoe 48+V8CwLPovLH4FbIEp4xelFX+3pr4JHBEbQt1lFt0FDBuxnACF3WbwIbtX3/KjJ3PRK UabHVveDJfPWLOcNpSdkXfu+F4Xb8wojs5bZyq++Vm7dZtseaMFIeHH/kbSr3mKelhCC IHrQ== 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=M5ACa8ocM+qERyHoUSAUwyRANREJ0gPDKqJ0/RXjXLY=; b=EwyUMI1ZedEuymAwWwPuT731ie7kpodrAo4JMxB8mZ+5xu4l67hJbYxsabxMIIcGU3 Jwqz+64cr1x0D7tb9VhAD15qY4MlsMK4rbMd3g7SqMKT6afKzbpfp6aYLZMHvcVwHUKJ d/UqlXFIHfy3KaULXRCOT30kXj7/Rz6HwyKaG+4t8PpeDN9ObgNq01dQUfX9/CSLwyqw JK5dPA+sEy95AU31110oGmSZGH5PNzHgN2J1CjxS5TXvwdBpOAFxHAvFiZSu2Zw9QdIg p8Wu2Z1KxY/B8Z8O3LFzSPBYwsMK4MQJyQa4aqQggGkuma0+rBxgGqdh39RNeTuF1kCL cpvQ== X-Gm-Message-State: AHPjjUiScLa2hNk7swMk41Fnbuey1XeFmJKTvIHzuR7lqC0z8D7t4AlQ PtUC/YBtPzJe72c6 X-Google-Smtp-Source: ADKCNb7RKczXtwEfZ+wgWb+EQPdbsgLKT23D5KEC29mwEgRzESdlSyen13007gJoVHP62a4DreD2Gw== X-Received: by 10.223.138.235 with SMTP id z40mr7385469wrz.14.1505074712231; Sun, 10 Sep 2017 13:18:32 -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 m128sm7717885wmf.0.2017.09.10.13.18.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Sep 2017 13:18:31 -0700 (PDT) To: "internals@lists.php.net" References: <508bb95c-162f-b1c0-f76f-08aa9bf2e93e@gmail.com> Message-ID: <218d59c9-c3dc-3ae4-2eab-5cd36e76c8cf@gmail.com> Date: Sun, 10 Sep 2017 21:18:30 +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: Content-Type: text/plain; charset=windows-1252; 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:16, Theodore Brown wrote: > On Sunday, September 10, 2017 12:45 PM Rowan Collins > wrote: > > >>> Would it be possible to add an optional `$strict` parameter to > >>> switch? E.g. > >>> ``` > >>> switch ($i, true) { > >> > >> I'd very much prefer a "strict switch ($i) { ... }" over a second > parameter. > > > > What do either of you think of my "switch-use" proposal, which would > spell this as "switch ($i) use (===)"? > > That seems more complicated and confusing than either of the other > options. Normally `use()` is for inheriting variables in anonymous > functions. The choice of "use" as the keyword was largely because it's already a reserved word, with multiple meanings in different contexts. As well as anonymous functions, it's the keyword for importing names from other namespaces, and for including a trait into a class. I would be perfectly happy to hear alternative keyword or syntax suggestions. It might not need a keyword at all, as it could just be "switch ($i ===) { ... }" or "switch ($i) === { ... }", although I'm not that keen on either of those. However, I think using "===" in some form is definitely clearer than ", true", which could mean anything; and even "strict" could have multiple meanings - for instance, a "strict switch" might be one where "break" was mandatory. Regards, -- Rowan Collins [IMSoP]