On 22.03.20, 18:17, "Dan Ackroyd" wrote:
> $condition || throw new Exception('$condition must be truthy')
> && $condition2 || throw new Exception('$condition2 must be truthy');
>
> The "Deprecate left-associative ternary operator"* RFC made it so that
> parentheses are required when ternary op
On Sun, Mar 22, 2020 at 5:17 PM Ilija Tovilo 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
Hi Andrea
> I would think we can just give `throw` an appropriate precedence so that
> expressions like the above do what is desired
The example are taken from the RFC online. The following expression is already
possible:
```php
throw $condition1 && $condition2 ? new Exception1() : new Excepti
Hi Dan,
Dan Ackroyd wrote:
Regarding the example:
$condition || throw new Exception('$condition must be truthy')
&& $condition2 || throw new Exception('$condition2 must be truthy');
The "Deprecate left-associative ternary operator"* RFC made it so that
parentheses are required when ternary
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,
> On Mar 22, 2020, at 2:39 PM, Ilija Tovilo wrote:
>
> Hi Mike
>
> Thanks for your feedback!
>
> Your solution works well and it's true that PHP would do just fine without
> accepting this RFC.
> However I do think this RFC makes sense for a few reasons:
>
> * I think that most people would e
Hi Mike
Thanks for your feedback!
Your solution works well and it's true that PHP would do just fine without
accepting this RFC.
However I do think this RFC makes sense for a few reasons:
* I think that most people would expect some of the examples (especially the
arrow function) to be valid P
Hi Dan
Interesting suggestion. I'll have to think more about how many of these
variations there are and if there's an easy way to recognize them.
Ilija
On 22.03.20, 18:16, "Dan Ackroyd" wrote:
On Sun, 22 Mar 2020 at 16:17, Ilija Tovilo wrote:
>
> Due to the modest feedback I’d l
> On Mar 22, 2020, at 1:16 PM, Dan Ackroyd wrote:
>
> On Sun, 22 Mar 2020 at 16:17, Ilija Tovilo wrote:
>>
>> Due to the modest feedback I’d like to move the throw expression RFC to
>> “under discussion”.
>>
>> https://wiki.php.net/rfc/throw_expression
>>
>
> Regarding the example:
>
> $co
On Sun, 22 Mar 2020 at 16:17, Ilija Tovilo wrote:
>
> Due to the modest feedback I’d like to move the throw expression RFC to
> “under discussion”.
>
> https://wiki.php.net/rfc/throw_expression
>
Regarding the example:
$condition || throw new Exception('$condition must be truthy')
&& $conditi
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,
11 matches
Mail list logo