Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109850 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 6960 invoked from network); 26 Apr 2020 09:42:49 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 Apr 2020 09:42:49 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8126E1804C3 for ; Sun, 26 Apr 2020 01:15:25 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,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-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-io1-f66.google.com (mail-io1-f66.google.com [209.85.166.66]) (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 ; Sun, 26 Apr 2020 01:15:24 -0700 (PDT) Received: by mail-io1-f66.google.com with SMTP id e9so15488274iok.9 for ; Sun, 26 Apr 2020 01:15:24 -0700 (PDT) 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=0TqiovIZTVYe3aUbePmQsFfTD9GkGSwDdVrUKW+L7Ug=; b=aPUu7NFArxTNZ36ykRKI0+upjgw3sBGP/zQOXwpj2Dwefm85t/Qk8jelxHqHrCQarP i2dSKBa4QUewQMdOD11PrbQWFccTl1h/D6TTi4xlkQv/h8jCdlvB5xWMDqWILlc7EaoV GPKflKlOQH7DNFJgtRofko/ENLWnUvfhUg1wWH8O4pp9mZHaR7tfMwXR9IulYkVIfDxi /8PEWjYUUpINSM46RsakGf55+BKvZyDwgw20PKex8dophBhnBdEO7CX4p6pKG6tQN4EE tcK93r7kZ7rUe173cCuVXbBNvazojt+WXY0DlU2feVxH8uCmjEPp51CwkoowmaqEv0G8 /FMA== 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=0TqiovIZTVYe3aUbePmQsFfTD9GkGSwDdVrUKW+L7Ug=; b=qkatfgmdP0I5wt3WkO1ADJSkfASOdVQ4sIzHhYjCUBmFBJUZePpxk2+cf4xlZ6XDtG K2/0ox4U3AN55tQA/Nel4QiD/b8rMCFwSBZcaxgokhs9V+MT0388jGDyHHHwcYRF1dgt mfqFjQ3RFx/cRZe/CUvV0+PsUyPMFPlZXDlF492CqBNQR9YwhAy/yknuvl7bAsl0Fq1A eotBG/Bu1tQAq2att4KpF7/ZsyntvZGcm5NbHPuPHJLkI24TWoVE1sx5H8nDU2ORXegD xdNq97tU5Tyzred+unezgeVt815d0P9yW3rx7FxvKWnGZosXzrIT0KVEqgOSDB8x/JFX JRww== X-Gm-Message-State: AGi0PuYgiOGqI6McAWTSqm1Oe1ULKBzAkhOA5G0zSzEYp8w3yZrIxG24 f8tBE3MBniZkDuZM7q8NExVFjvf4ijGpIK5DIPM= X-Google-Smtp-Source: APiQypLL0hYZUlLzJLR/1IFxQnHkEJcuTNEvvBnajmyxIMkJA6vmjjKnj0BvkqvnB0rx+FF/xMiJRgg1klbYv4krPC4= X-Received: by 2002:a02:9f8b:: with SMTP id a11mr15484477jam.122.1587888922787; Sun, 26 Apr 2020 01:15:22 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 26 Apr 2020 10:15:11 +0200 Message-ID: To: Ilija Tovilo Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000002f863905a42d336d" Subject: Re: [PHP-DEV] [VOTE] match expression From: ocramius@gmail.com (Marco Pivetta) --0000000000002f863905a42d336d Content-Type: text/plain; charset="UTF-8" Heya, Just following up here, after private convo on why I voted "NO" on this RFC. My rationale for not wanting the RFC (in its current state) is that I don't want more procedural constructs in the language. Specifically, I'm fine with: match () { => , => , => , default => , } I'm not fine with allowing procedural code to be executed on the right-hand-side of each match. It would still possible to hide procedural code in the right-hand-side of the match, but luckily without affecting the outer scope: match () { => (function () { /* insert your procedural nightmare of choice here */ })(), => (fn () => /* more procedural nightmares here */)(), default => , } By enforcing only expressions to be on the right-hand-side, we get some nice side-effects too: * no need to discuss `continue` * no need to discuss `break` * no need to discuss `return` Overall, that would be a win-win. A point has been risen about the fact that using closures increases memory usage and stack frames: that's a compiler optimization concern, and probably also a minor one, since I'd discourage procedural code on the RHS anyway :-) I'd be voting YES on the RFC if the blocks were gone. On Sat, Apr 25, 2020 at 12:40 PM Ilija Tovilo wrote: > Hi internals > > I have opened the voting on the match expression RFC. It will end on > 9th of May, 2020. > https://wiki.php.net/rfc/match_expression > > Here are the last changes: > > In the last update I mentioned allowing return values in blocks. > Unfortunately, we discovered some technical difficulties (memory > leaks) which are very hard to solve. Nikita is experimenting on a > possible solution. There was also a fair bit of backlash over the > syntax. Thus I have decided to move block expressions to a separate > RFC. Note that blocks with just statements remain part of this RFC. > > The "duplicate condition" warning mentioned by Dan was removed due to > the arguments made by Tyson. > > I have also moved the optional semicolon for the match in statement > form to a separate vote as this was another controversial part of the > proposal. > > Furthermore I have added another secondary vote for allowing to drop > (true) conditions as that was suggested multiple times: > > match { > $age >= 30 => {}, > $age >= 20 => {}, > $age >= 10 => {}, > default => {}, > } > > // Equivalent to > > match (true) { > $age >= 30 => {}, > $age >= 20 => {}, > $age >= 10 => {}, > default => {}, > } > > There is a separate poll for specifying the reason for a "no" vote. > Let me know if there are any other reasons so I can add those to the > poll. > > A personal thank you goes out to Tyson for his guidance! > > Regards, > Ilija > Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ --0000000000002f863905a42d336d--