[PHP-DEV][RFC][VOTE] Explicit octal integer literal notation

2020-11-11 Thread G. P. B.
Greetings Internals, The vote for the "Explicit octal integer literal notation" RFC is now open. https://wiki.php.net/rfc/explicit_octal_notation It will last two [2] weeks, until 2020-11-25. Best regards, George P. Banyard

[PHP-DEV] Supports to ?:= assignment operator

2020-11-11 Thread David Rodrigues
Hello! PHP currently supports ??= assignment, as shortly to $a = $a ?? null, but it does not supports ?:= as shortly to $a = $a ?: null. There are some reason to that? - https://wiki.php.net/rfc/null_coalesce_equal_operator - https://wiki.php.net/rfc/short_ternary_equal_operator Thanks! Atenc

[PHP-DEV] Re: Supports to ?:= assignment operator

2020-11-11 Thread Björn Larsson
Hi, Den 2020-11-11 kl. 17:18, skrev David Rodrigues: Hello! PHP currently supports ??= assignment, as shortly to $a = $a ?? null, but it does not supports ?:= as shortly to $a = $a ?: null. There are some reason to that? - https://wiki.php.net/rfc/null_coalesce_equal_operator - https://wiki.p

Re: [PHP-DEV] [RFC] Draft - Closure self reference

2020-11-11 Thread Dan Ackroyd
On Tue, 10 Nov 2020 at 17:39, Hans Henrik Bergan wrote: > > something i'm missing from Javascript is the ability to give names to > closures, ...the name is optional, and only visible inside the closure > itself, and unfortunately this is not legal in PHP, i wish it was. I really like that...but

Re: [PHP-DEV] [RFC] Draft - Closure self reference

2020-11-11 Thread Christoph M. Becker
On 11.11.2020 at 18:39, Dan Ackroyd wrote: > On Tue, 10 Nov 2020 at 17:39, Hans Henrik Bergan wrote: >> >> something i'm missing from Javascript is the ability to give names to >> closures, ...the name is optional, and only visible inside the closure >> itself, and unfortunately this is not legal

Re: [PHP-DEV] [RFC] Draft - Closure self reference

2020-11-11 Thread David Rodrigues
I think that introducing a new variable, that even uncommon, could cause BC. My suggestion is to reuse the keyword `as` to set a variable that will represent its own closure. It is more flexible once that we could choose any name and reuse in nested closures. It is pretty similar to how SQL works

Re: [PHP-DEV] [RFC] Draft - Closure self reference

2020-11-11 Thread Rowan Tommins
On 11/11/2020 17:59, Christoph M. Becker wrote: In JavaScript, a named function expression is different to a function declaration: var fn = function foo() {console.log('blah')} foo() => Uncaught ReferenceError: foo is not defined vs. function foo() {console.log('blah')}

Re: [PHP-DEV] [RFC] Draft - Closure self reference

2020-11-11 Thread Michael Voříšek - ČVUT FEL
Hi everyone, maybe a bad idea, but what about addressing the "Principle of least astonishment" issue by allowing to specify/capture the variable after the function is assigned: $f = function () use ($f) {...}; With kind regards / Mit freundlichen Grüßen / S přátelským pozdravem, Michael Vo

Re: [PHP-DEV] [RFC] Draft - Closure self reference

2020-11-11 Thread Hans Henrik Bergan
if i have understood the "as"-suggestion correctly: $fn = function() as $lambdaOrAnyName {var_dump($lambdaOrAnyName);}; (function() as $lambdaOrAnyName{var_dump($lambdaOrAnyName);})(); then that syntax is fine with me. this is also very close to how it works in JavaScript (except the "as" part),

[PHP-DEV] strict_types will be default at some moment?

2020-11-11 Thread David Rodrigues
Hello! I have been asked by a friend if declare(strict_types=1) will be applied by default for some version of PHP, like 9.x or will it be always required by all scripts forever. Someone can tell me? If yes, what is the reason for requiring it? Why it can't be the default behavior (or maybe, the

Re: [PHP-DEV] strict_types will be default at some moment?

2020-11-11 Thread Claude Pache
> Le 11 nov. 2020 à 21:20, David Rodrigues a écrit : > > Why it can't be the default > behavior (or maybe, the unique behavior). IMNSHO, a good reason for keeping weak typing, is that developers are not willing to review and refactor megabytes of valid code that take advantage of implicit t

Re: [PHP-DEV] strict_types will be default at some moment?

2020-11-11 Thread Rowan Tommins
On 11/11/2020 20:20, David Rodrigues wrote: I have been asked by a friend if declare(strict_types=1) will be applied by default for some version of PHP, like 9.x or will it be always required by all scripts forever. Someone can tell me? If yes, what is the reason for requiring it? Why it can't b

Re: [PHP-DEV] strict_types will be default at some moment?

2020-11-11 Thread G. P. B.
On Wed, 11 Nov 2020 at 21:47, Rowan Tommins wrote: > On 11/11/2020 20:20, David Rodrigues wrote: > > I have been asked by a friend if declare(strict_types=1) will be applied > by > > default for some version of PHP, like 9.x or will it be always required > by > > all scripts forever. Someone can

[PHP-DEV] Re: strict_types will be default at some moment?

2020-11-11 Thread Mark Randall
On 11/11/2020 20:20, David Rodrigues wrote: If yes, what is the reason for requiring it? Why it can't be the default behavior (or maybe, the unique behavior). There was some discussion around the idea of adding language editions to PHP for 8.0, however the pandemic resulted in to the in-person