On Sat, 16 May 2020 at 11:14, Pavel Patapau <algerd....@gmail.com> wrote:

> Hello everyone,
>
> I want to propose new syntax addition - guard statement, that executes
> code only if expression equals false and must contain control-flow
> changing code, and written a respective RFC:
>
> https://wiki.php.net/rfc/guard_statement
> <https://wiki.php.net/rfc/unbundle_xmlprc>
>
> Implementation in progress.
>
> I started work before this proposal https://externals.io/message/110107
> and respected some moments in the RFC.
>
>
> Thanks for consideration,
> Pavel
>

This is a fat no from my side.
I see no benefit instead of using a normal if construct.
This guard syntax has more keystrokes, doesn't read like "normal" English,
has massive BC implications.

I don't see why this would encourage defensive programming as you still
need to write code with this in mind.
Moreover, we already have assertions [1] although they could be improved,
I'd rather have this be the focus than introducing this guard proposal.

Best regards

George P. Banyard

[1] https://www.php.net/manual/en/function.assert.php

Reply via email to