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.tov...@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
>
>
>
>

Reply via email to