Re: [PHP-DEV] [RFC] Short-function syntax

2020-10-26 Thread Mike Schinkel
> On Oct 26, 2020, at 10:23 AM, Michał Marcin Brzuchalski > wrote: > > Hi Larry, > > I'm wondering why we hadn't thought yet about reducing the need for $this > in this syntax. > Since arrow functions have an ability to capture variables defined in > parent scope why not > think of the same f

Re: [PHP-DEV] [RFC] Short-function syntax

2020-10-26 Thread Michał Marcin Brzuchalski
Hi David, pon., 26 paź 2020 o 15:29 David Rodrigues napisał(a): > > The use of > instead of => could if possible indicate the method being > void > > and reduce even more: > > I think that for void, it could just identify it and not return nothing > automatically. > > function a(): int => b(); /

Re: [PHP-DEV] Bug #80248 - Swapping parameter names during inheritance does not throw

2020-10-26 Thread Rowan Tommins
On 26/10/2020 13:12, Michael Voříšek - ČVUT FEL wrote: I am writing regarding bug 80248. Currently, PHP 8 allows parameter reuse at different position, which I belive is very dangerous, as passed parameters may be passed in a different order with different object impl. Hi Michael, Yes, this w

Re: [PHP-DEV] [RFC] Short-function syntax

2020-10-26 Thread David Rodrigues
> The use of > instead of => could if possible indicate the method being void > and reduce even more: I think that for void, it could just identify it and not return nothing automatically. function a(): int => b(); // equivalents to function a(): int { return b(); } function x(): void => y(); //

Re: [PHP-DEV] Is there any interest for object constructor shorthand *just forstdClass*

2020-10-26 Thread Rowan Tommins
On 26/10/2020 09:02, Andreas Bittner wrote: With regards to the JSON looking different when casting to object: ``` json_encode([1,2,3]); // result: [1,2,3] json_encode((object)[1,2,3]); // result: {"0":1,"1":2,"2":3} json_encode([]); // result: [] json_encode((object)[]); // result: {} Than

Re: [PHP-DEV] [RFC] Short-function syntax

2020-10-26 Thread Michał Marcin Brzuchalski
Hi Larry, I'm wondering why we hadn't thought yet about reducing the need for $this in this syntax. Since arrow functions have an ability to capture variables defined in parent scope why not think of the same for class properties which will automatically reduce short methods verbosity. class X {

[PHP-DEV] Bug #80248 - Swapping parameter names during inheritance does not throw

2020-10-26 Thread Michael Voříšek - ČVUT FEL
Hi, I am writing regarding bug 80248. Currently, PHP 8 allows parameter reuse at different position, which I belive is very dangerous, as passed parameters may be passed in a different order with different object impl. See https://3v4l.org/X8omS , which is against OOP and LSP. I belive, we

Re: [PHP-DEV] why is non-crypto hashes excluded from/ext/hash/bench.php ?

2020-10-26 Thread Hans Henrik Bergan
@Christoph M. Becker haha that's probably it, i guess that long ago PHP didn't have any non-crypto hash algos, one of the results read "256MB Windows 2000" when was the last time someone rolled a 256MB ram windows 2000? (am rolling some 128MB ram VPS's, but rolling Windows with such amounts of ram

Re: [PHP-DEV] why is non-crypto hashes excluded from/ext/hash/bench.php ?

2020-10-26 Thread Christoph M. Becker
On 26.10.2020 at 11:16, Hans Henrik Bergan wrote: > @Nikita Popov > >> How did you draw the conclusion that non-crypto hashes are not included? > > yeah i know they're there when you run them, but if you look at the > benchmarks in the source code, from line 4 - 71, all the non-crypto > hashes ar

Re: [PHP-DEV] why is non-crypto hashes excluded from /ext/hash/bench.php ?

2020-10-26 Thread Hans Henrik Bergan
@Nikita Popov > How did you draw the conclusion that non-crypto hashes are not included? yeah i know they're there when you run them, but if you look at the benchmarks in the source code, from line 4 - 71, all the non-crypto hashes are absent there, https://github.com/php/php-src/blob/master/ext

Re: [PHP-DEV] why is non-crypto hashes excluded from /ext/hash/bench.php ?

2020-10-26 Thread Nikita Popov
Are they? When I run the script, I see things like crc and fnv show up. How did you draw the conclusion that non-crypto hashes are not included? Nikita

Re: [PHP-DEV] [RFC] Short-function syntax

2020-10-26 Thread Nikita Popov
On Tue, Oct 20, 2020 at 8:20 PM Larry Garfield wrote: > A while back, Nikita mentioned that it should now be easy to offer an > abbreviated syntax for functions that are just a single expression. I > decided to take a crack at it and it turns out he was right. I thus offer > this RFC: > > https

Re: [PHP-DEV][RFC] Add support for explicit octal notation for integer literals

2020-10-26 Thread Nikita Popov
On Wed, Oct 21, 2020 at 4:59 PM G. P. B. wrote: > Hello internals, > > A rather short RFC about adding support for the "0o" prefix for octal > integers. > https://wiki.php.net/rfc/explicit_octal_notation > > Surprisingly PHP already accepts the prefix within octdec() and > base_convert(). > > I h

Re: [PHP-DEV] Is there any interest for object constructor shorthand *just forstdClass*

2020-10-26 Thread Andreas Bittner
I don't follow; is the resulting JSON different if you cast to object, or is there some other reason you prefer an object over using an associative array directly? The by-reference semantics of objects vs arrays in PHP. *shrug* If you want things to be mutable between functions, stick an & in