Re: [RFC][DISCUSSION] throw expression
| From: | Matthew Brown | Date: | Sun, 22 Mar 2020 21:32:57 +0000 |
| Subject: | Re: [RFC][DISCUSSION] throw expression | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109212@lists.php.net to get a copy of this message | ||
I think this is great.
It reminds me of a construct that Hack introduced called "as expressions":
With throw expressions the Hack assignment,
$a = $b as string;
would be equivalent to the PHP assignment
$a = is_string($b) ? $b : throw new TypeError('$b must be a string');
If this passes, it would be great to see sugary equivalents get added to
the language too.
On Sun, 22 Mar 2020 at 12:17, Ilija Tovilo <ilija.tovilo@me.com> wrote:
> Hi everybody! I hope you’re doing well.
>
>
>
> Due to the modest feedback I’d like to move the throw expression RFC to
> “under discussion”.
>
> 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, as
> 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!
>
>
>
> Regards
>
>
>
>