Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112506 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 62263 invoked from network); 14 Dec 2020 23:24:01 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Dec 2020 23:24:01 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8DFBE1804E1 for ; Mon, 14 Dec 2020 14:54:48 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 14 Dec 2020 14:54:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1607986486; bh=i72j2y6v/K825GnPLvBB48NSPLRf1g9p6jL1lfvlUWU=; h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To; b=eleHYtZWTnsXeBrAEYyHdoyx+Jm9KWQdV6CP0dq39Uq11tiPuikeh1YpzSIVLbjSx /An96BtdYErj9tEyMaF2qg4ST/0CbP4RmD6HvN9VJgyycSXYg4QUhcEUZfJMco/7Xa v2FpjVkZo66+4CYVXImqW6FpLYIHl8tPEWwkzVtQ= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.178.120] ([24.134.51.41]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MbAh0-1kHnqf3Zs0-00bbMf for ; Mon, 14 Dec 2020 23:54:45 +0100 To: internals@lists.php.net References: Message-ID: Date: Mon, 14 Dec 2020 23:55:14 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-Provags-ID: V03:K1:ytJoFTh0c611XEgRDfE+unXdGhfVN4HAyM3x8tcI3f6FfymqBY5 sou4VHqC81tweAXVZPAZRmUWCtpkKlDPcmzGtzJYFzDQ90Ta4BALghRPvGkXvJK8lU7UzsH wBsuK9zfyKoTaVJoQGWnSpxyhrfgKPgdNaBG8bjOWTuONGmSKALfREp7JzdYsgudv9u420L E5DCwZk13jL+1VL3l3cGQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:56hmB/iHEWM=:VHGI4Kw0gMUJyaZUwpY9+m 0+LdergE3Omt1F2TaMF3qWfF76FaUK8WvU/EOB9WtVA32WyI+f1HRZGgztP+T3elM9KqEt0i8 +CJFaPMOO/exgNrQCqU5URY7/VnqJG8qn3w1GRmMSffzVzbjgXbJcz86Ms9CFRvcHl4lM4bx4 ksq4jWc0+4zpOumsCMTqqafYsEIsk9PMq/EM5IsYqwhFjepBR54gDtjgMH98vV2xmv9vUc5ga sCwxSAsSIvhCAT8biZ2YWhSQbMwRL2/s2LQ4snPUsPmySBAUQHf4yqRJvDQOaUH8Ale/72SWz Ytc+xhtR+Xuv02a4njWOeSw2P/2iBySWe9ZSOlHwKh44cJgbLuS9y0z3cv7xtq4Gl64atba3W zNl2OJgk/KLdU2VlGWGjzI1tJNLdqD6dPEE/SJjOloaPUVQag3GcGUTKppMKg6ye3LcrO2a4s jYfvpBw5QSru2oeC7U7OSw4Pzhjg4B9DhRkwQBWRXS7i6v8ZaX9PgHpQEOn8iRPqObd7RjPwc 0p1xuauKsF+eHtQ52325/XqtDxao5uGAwG/ZvboG2dQfG7bIsA6ftZ31nhVQA/uGBN6Xij/OW Mk9XpsgJ0X8yLvSczBPPcTBQd23hn22GxF+OXPQzNh1Zu7tId9I0dGZA6C+BFaC4IpqXfVuAc I/GrSovBhdN9JjbiQKVxJSo6Q26OL1OQu6flLf/MUmcv4v4TUQG4ixGdgfzgeKcTynFyeeqJQ z9oMgtBvrNaFzq7p4collLfKfmFSQxGsJTETXFaeoRXPbychd2PSXvg9yQXPxya5ktDZ2ef2p 5y07wQfGQAHtm6dNHBvnrguJ5HOZi6lo4EV+xtxZkhqZvJPXjaPbgxZ0Rxp8t8vbJrlypxqVk ZBnD8aKQZXZ233uOzV3g== Subject: Re: [PHP-DEV] [RFC] Short-match From: a.leathley@gmx.net (Andreas Leathley) On 14.12.20 18:33, Larry Garfield wrote: > I present to Internals this tiny RFC to follow up on the match() express= ion RFC from earlier in the year. There was solidly positive support for = this shortcut previously but it was removed for simplicity at the time, wi= th the intent to bring it back later. It's now later. > > https://wiki.php.net/rfc/short-match I think it is a good addition that will make code clearer. If the main counter-argument is that "if - elseif - else" does the same thing, comparing the syntax to that and showing some real-world examples might even convince some more people who think it is unnecessary, as the code mostly speaks for itself, but the example currently in the RFC might be a bit too simplistic to be convincing for the sceptics. It would also be interesting how much switch(true) is used in open source code currently, as it is the currently used "equivalent" to match(true) - I know it is in some parts of the Symfony code, probably because it is often easier to scan over when compared to huge if / elseif blocks. match(true) is clearly an improvement to switch(true), so while match has almost no use so far in PHP code, switch(true) definitely has.