Re: [PHP-DEV] Proposal For Return-If / Early Return / Guard Clause Syntax

2020-05-16 Thread Peter Stalman
A few thoughts: 1. I agree with the sentiment that this syntactic sugar doesn't actually save any verbosity, so it's not really syntactic sugar at all. 2. There appears to now be another RFC by Pavel Patapau, specifically focused on a Guard statement as a new keyword

Re: [PHP-DEV] Graceful timeout

2020-05-16 Thread Jakob Givoni
On Sat, 16 May 2020 at 19:42, David Rodrigues wrote: > Hello! > > Currently we can use set_time_limit() to specify that our script will run > by some seconds before we get "fatal error: maximum execution time of 1 > second exceeded". And we can't catch it and keep running. > > I believe that it

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] Graceful timeout

2020-05-16 Thread Niklas Keller
Hey David, I guess you're looking for a preemptive timeout. I guess an alarm signal and PHP's async signal handling will be your best bet here. In case you're looking for a cooperative timeout, https://amphp.org/ and it's `Amp\Promise\timeout()` / `TimeoutCancellationToken` might be helpful.

Re: [PHP-DEV] Graceful timeout

2020-05-16 Thread tyson andre
Hi David, > You can probably implement this already with PHP's tick functionality (https://www.php.net/manual/en/function.register-tick-function.php), as > long as the code in the anonymous function does PHP statements/function > calls. > > If your problem is waiting for an external resource to

Re: [PHP-DEV] [RFC] opcache.no_cache: Opcache optimization without any caching

2020-05-16 Thread tyson andre
> In my opinion, configuration names should never be "in the negative". > Instead of defaulting to opcache.no_cache=0, default to opcache.cache=1. I see your point - there are only a few negative ini names I see in phpinfo() (disable_functions, disable_cache), and those are for lists of

Re: [PHP-DEV] SPL development interest

2020-05-16 Thread Jakob Givoni
Thank you guys for your insights! You pretty much confirmed my fears about the SPL extension. The reason I was wondering about it was mostly for understanding where one would put Classes, Interfaces and Traits that should be essential parts of the language. F.ex. it seems the Countable interface

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] Graceful timeout

2020-05-16 Thread Derick Rethans
Hi David, On Sat, 16 May 2020, David Rodrigues wrote: > Currently we can use set_time_limit() to specify that our script will > run by some seconds before we get "fatal error: maximum execution time > of 1 second exceeded". And we can't catch it and keep running. You can set-up a shutdown

Re: [PHP-DEV] [RFC] opcache.no_cache: Opcache optimization without any caching

2020-05-16 Thread Derick Rethans
On Sat, 16 May 2020, tyson andre wrote: > I've created the RFC https://wiki.php.net/rfc/opcache.no_cache to make > the opcode optimizer and JIT available without opcode caching, through > a new setting `opcache.no_cache=1`. In my opinion, configuration names should never be "in the negative".

[PHP-DEV] Graceful timeout

2020-05-16 Thread David Rodrigues
Hello! Currently we can use set_time_limit() to specify that our script will run by some seconds before we get "fatal error: maximum execution time of 1 second exceeded". And we can't catch it and keep running. I believe that it is interesting to create a function that is able to limit

[PHP-DEV] [RFC] opcache.no_cache: Opcache optimization without any caching

2020-05-16 Thread tyson andre
Hi internals, I've created the RFC https://wiki.php.net/rfc/opcache.no_cache to make the opcode optimizer and JIT available without opcode caching, through a new setting `opcache.no_cache=1`. So far, the feedback I've gotten is that having the ability to optimize without caching would be

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] Re: [RFC] Strict operators directive

2020-05-16 Thread Max Semenik
On Sat, May 16, 2020 at 5:20 PM Mark Randall wrote: > IMHO we need to know what is happening with editions, as I think this > would be an ideal candidate for that rather than another declare On the other hand, a declare would allow a gradual upgrade path where people can use strict mode for

[PHP-DEV] Re: [RFC] Strict operators directive

2020-05-16 Thread Mark Randall
On 15/05/2020 23:03, Arnold Daniels wrote: Hi all, I'd like to restart the discussion for the strict_opterators RFC ( https://wiki.php.net/rfc/strict_operators). I think this kind of change will have a long term positive impact, but it will require a lot of work to update code. IMHO we

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

Re: [PHP-DEV] [RFC] Strict operators directive

2020-05-16 Thread Dan Ackroyd
On Fri, 15 May 2020 at 23:03, Arnold Daniels wrote: > I'd like to restart the discussion for the strict_opterators RFC ( > https://wiki.php.net/rfc/strict_operators). Hi Arnold, That RFC is quite big, and I'm finding it hard to fit it all in my head. I know it's annoying when people ask for