Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109327 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 64321 invoked from network); 26 Mar 2020 11:09:30 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 Mar 2020 11:09:30 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B1F471804B8 for ; Thu, 26 Mar 2020 02:34:21 -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-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (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 ; Thu, 26 Mar 2020 02:34:21 -0700 (PDT) Received: by mail-lf1-f43.google.com with SMTP id j11so4217430lfg.4 for ; Thu, 26 Mar 2020 02:34:21 -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=ooWW/xBqHdVHVfRI8l+sdu84NMFK2Ep456ihZK3jxWE=; b=KQw08NbtTiNug1yg+WbOvKRoBzV2bxAn3Is/5U9qKMjBdmSZgI/WuMiZc6+bx6pBle fUtKSRONZa8DGbw7wMdcCbCnDFjlSO5kAFeBJKbAvZ7U4T3fOVHpiZZD4hb+zqHYVw5+ ZAiVgNwSKRVUzIBbqNnhILYzJ0qr0OmmwYiOacCT0kBjkDI7G4SIKQyedIn3Jm9gLUt8 9HwsmC4MG3hTYs27KDGJadmii4RikEQpHU36aFEVOOJ2q5FlX7rQnVDzRCO6dYzIGoYk KTJl72EqigEbx5gjf7khtv8Z6PNU0fD/XAbVnt9j4vqyGWsp0/jB83TtuBgbW/UJb5DO ZNQA== 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=ooWW/xBqHdVHVfRI8l+sdu84NMFK2Ep456ihZK3jxWE=; b=F8eWtgS302o7sYyCE0tzdw9KmQBvmhS0X0LWSVLHyJf5ppyeW/zFCbGN3d7lrQCyFq wcWjwxXte+KrONdKWZKkzodIsze/76Ih1u0vVa5wOs/0WnT0BnbJ93Zd5zmhWJQdxYeq nCb6eE1xBFnckeVHko2C2tJmET006NAn2/0E2oUR6NJ/uLIEJIfhntSY9shmGY+d2A+6 P6jiG9cgOdMrfFttwLkmwtcWIEnmwwTXf2c42baZ8ApnXDy7ripqeducIsUIuGXDbSvy 25Py7oBUv3snK4KzI7WFdQDrraaRUdYXAhwrIKXLSOPmczxNvpHJTvJKND9uLnzQ9xUA JY5g== X-Gm-Message-State: ANhLgQ1g1KljOBkUfVID2SVMiAD7MNDGIV3+gvQ+aHrQlxlIhl4S98Ci kl8Ckj51dJnMSrL6VglhmKzVPPT6SqKGuHODFnI= X-Google-Smtp-Source: ADFU+vsSjz6XotSt5dW2fIWs/x3E5rXfCiys7eBNxnoy95osuiLS078qKxoW2WR+sLerkD8gz/+FFAUK4yQiGkxEvKg= X-Received: by 2002:a05:6512:31d6:: with SMTP id j22mr5018833lfe.173.1585215259719; Thu, 26 Mar 2020 02:34:19 -0700 (PDT) MIME-Version: 1.0 References: <5BEF8264-4003-4056-A31C-FF8BEE85FED6@me.com> In-Reply-To: <5BEF8264-4003-4056-A31C-FF8BEE85FED6@me.com> Date: Thu, 26 Mar 2020 10:34:03 +0100 Message-ID: To: Ilija Tovilo Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000072bd0005a1beb0f7" Subject: Re: [PHP-DEV] [RFC][DISCUSSION] throw expression From: nikita.ppv@gmail.com (Nikita Popov) --00000000000072bd0005a1beb0f7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Mar 22, 2020 at 5:17 PM Ilija Tovilo wrote: > Hi everybody! I hope you=E2=80=99re doing well. > > > > Due to the modest feedback I=E2=80=99d like to move the throw expression = RFC to > =E2=80=9Cunder discussion=E2=80=9D. > > https://wiki.php.net/rfc/throw_expression > > > > In short, the RFC proposes to convert the throw statement into an > expression to make it usable in arrow functions, the coalesce operator, a= s > well as the ternary/elvis operator. > > If you have any feedback, concerns, or if you want to express your > interest or lack thereof, let me know! > Looks like a reasonable change to me. Maybe interesting to compare with the ECMAScript and C# proposals you reference: The ECMAScript proposal (https://tc39.es/proposal-throw-expressions/) defines the throw expression as a very high precedence operator, rather than a low precedence one. There's discussion on that in https://github.com/tc39/proposal-throw-expressions/issues/10. Reading that thread, it seems like nobody actually wants the high precedence version, but there are some ECMAScript-specific issues with low precedence, because of conflicts with comma expressions. Thankfully that doesn't apply to us. The C# proposal ( https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals= /csharp-7.0/throw-expression) limits the use of throw expressions to specific context only (in short lambdas and on the right hand side of ?: and ??). I'm personally not a fan of that, unless there's a technical motivation for that. If it's just about enforcing coding style, there's already plenty of weird expressions you can write right now. I don't want to add special cases to the language specification to enforce someone's style preferences. > The "Deprecate left-associative ternary operator"* RFC made it so that > parentheses are required when ternary operators are nested in > complicated statements. I should probably explicitly say here that the parentheses are required not because I think it is a good idea to require them, but to avoid changing the interpretation of an expression from one version to the next. Given that we did end up changing the precedence of the "." operator (rather than requiring parentheses), this choice is somewhat dubious now, and it would have been better to simply change the interpretation of the ternary in PHP 8 as well. Regards, Nikita --00000000000072bd0005a1beb0f7--