Re: [PHP-DEV] [RFC] Guard statement

2020-05-16 Thread Mike Schinkel
> On May 16, 2020, at 5:13 AM, Pavel Patapau 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: > >

Re: [PHP-DEV] [RFC] Guard statement

2020-05-16 Thread Jakob Givoni
On Sat, May 16, 2020 at 11:14 AM Pavel Patapau 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: > >

Re: [PHP-DEV] [RFC] Guard statement

2020-05-16 Thread Rowan Tommins
On 16/05/2020 10:13, Pavel Patapau wrote: 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 Hi Pavel, This

Re: [PHP-DEV] [RFC] Guard statement

2020-05-16 Thread John Bafford
Pavel, On May 16, 2020, at 05:13, Pavel Patapau 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: > >

Re: [PHP-DEV] [RFC] Guard statement

2020-05-16 Thread G. P. B.
On Sat, 16 May 2020 at 11:14, Pavel Patapau 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: > >

Re: [PHP-DEV] [RFC] Guard statement

2020-05-16 Thread Ilija Tovilo
Correction: > guard (null !== $x = foo()) { return; } > // No benefit over > if (null !== $x = foo()) { return; } My example was wrong, should've been: > if (null === $x = foo()) { return; } -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit:

Re: [PHP-DEV] [RFC] Guard statement

2020-05-16 Thread Ilija Tovilo
Hi Pavel > https://wiki.php.net/rfc/guard_statement > First of all, thanks for your proposal! I'm a bit skeptical. guard is mostly useful in Swift because it's a strictly typed language. let x = foo() // type Int? if x == nil { return } // x is still

Re: [PHP-DEV] [RFC] Guard statement

2020-05-16 Thread Dan Ackroyd
On Sat, 16 May 2020 at 13:14, Max Semenik wrote: > > Note how no language mentioned in that article has this keyword, Except Swift which is one of the first languages to use this: https://www.hackingwithswift.com/new-syntax-swift-2-guard > I would go further claim that in my opinion all current

Re: [PHP-DEV] [RFC] Guard statement

2020-05-16 Thread Max Semenik
On Sat, May 16, 2020 at 12:14 PM Pavel Patapau 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 Both your initial email and your

Re: [PHP-DEV] [RFC] Guard statement

2020-05-16 Thread Benas IML
Hello, first of all, thank you for the RFC but this is a big no-no for me. Your arguments as to why it's "okay" to make a BC break doesn't make a lot of sense given the huge "genericness" of the keyword "guard". Laravel's authentication system is used across thousands of projects (if not more)

[PHP-DEV] [RFC] Guard statement

2020-05-16 Thread Pavel Patapau
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