Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112513 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 11423 invoked from network); 15 Dec 2020 09:30:05 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Dec 2020 09:30:05 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9E9391804C9 for ; Tue, 15 Dec 2020 01:00:59 -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.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,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 mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (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 ; Tue, 15 Dec 2020 01:00:59 -0800 (PST) Received: by mail-lf1-f54.google.com with SMTP id u18so37348430lfd.9 for ; Tue, 15 Dec 2020 01:00:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OSF/SWSkVa1oAovbFTt75RlmigBY8mM7pv5k+zq49Yo=; b=JF4+iOurqQf2GmNGTpELAxJjLTNQD9oQxv4TalC9SuM4OQmEgq/ovsYwZ6AI+TXJXk l4UjPa5kq8Un86B17DHJhFTQCte9KYfe0b5i0RqK/Xy3X1aCeT5Yhc+eiiOeNJmWwa3B 5VaNNOzkdrMAVtsNPvKZOTSukpwn6hL5bwyYq00e+8/YckqaB28bUbvBLAq0Gfq+n3l1 HZLKv9aBkWM8V27zENek98oufq8q9aErp1neZOrNcxe/qg9HS30WSxPPDil56VfIAhkq byxZ4erdztZzTRJXuWMJH1ixVWticP5mzeY6GFO8ohoLXXgIpis9RGxF+0L+doxnRF01 zBYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OSF/SWSkVa1oAovbFTt75RlmigBY8mM7pv5k+zq49Yo=; b=NDZNrBbbbYeqfQYUQy3OO/GywaWQaVwuN/hIlfEImRyeM5Zpu08tdDI5m4VxNTqkqE Faj8X3orjJfpIX/Pd5jsW97Ei40WN1VC6iYHvZ5hbQAWl8+0WKtNLTqzdpwvnxo1lfqX 1Kd119tw14Ow/iPeTRUii7YFbfZVog7F2Px38i3ZShUMh2UmBaadbzluJQrxQEPly8FJ Us9daMPf7IEiXPrlAbbDPUemrfUITIP1jn0LuyThUt6CsJrP6ZIDL/9evNWethb9rWTp 9fgYDJqAjCrYobpwHBRPE9AifLbeGLoKgcIPZMZHK76dWiZAu/Fd+1A1XVX5WhdlQMS5 PMDA== X-Gm-Message-State: AOAM532b7W5dCSjGfIxYH0ee5ZLuDeSd6A8EytTdcol+z7WzlXxRX2UL FtfoXUdha+rezK5HJlYEwS6ThPbJ/VgAw5WffqkzxrHCT8M= X-Google-Smtp-Source: ABdhPJyYToPBqkICZOKgZzfRcCGN0157AqAyUbRCGyT9PRZxLKTWcE6QEt23x1lpBygdhGBPirF7PfNgu5AwLqAfA9I= X-Received: by 2002:ac2:4431:: with SMTP id w17mr8850630lfl.223.1608022856718; Tue, 15 Dec 2020 01:00:56 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 15 Dec 2020 10:00:40 +0100 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="0000000000002a5c1205b67cff17" Subject: Re: [PHP-DEV] [RFC] Short-match From: nikita.ppv@gmail.com (Nikita Popov) --0000000000002a5c1205b67cff17 Content-Type: text/plain; charset="UTF-8" On Mon, Dec 14, 2020 at 6:34 PM Larry Garfield wrote: > I present to Internals this tiny RFC to follow up on the match() > expression RFC from earlier in the year. There was solidly positive > support for this shortcut previously but it was removed for simplicity at > the time, with the intent to bring it back later. It's now later. > > https://wiki.php.net/rfc/short-match > > -- > Larry Garfield > larry@garfieldtech.com > Just like Sara, I'm not strongly opposed to this, but I'm also not sure this is worthwhile. Writing "match (true) {" instead of "match {" is not particularly tedious when compared to the size of the remaining structure. Writing "match (true) {" has the advantage of being more explicit about what this actually does, namely a "true ===" comparison. If it is omitted, a reasonable person might think that match { preg_match(...) => ... } is going to do something sensible, like it would if placed inside an "if()". But it does not, as preg_match() returns 1, not true, and as such the match arm will never be taken. This is more obvious when the value that is being compared against is explicitly given. Of course, with "match {" being a dedicated syntax, we could make it a TypeError to use a non-bool match arm... Regards, Nikita --0000000000002a5c1205b67cff17--