Re: [PHP-DEV] [RFC] Allow object keys in arrays

2021-01-18 Thread Nikita Popov
On Wed, Jan 13, 2021 at 10:08 AM Rowan Tommins wrote: > On 12/01/2021 16:51, Marco Pivetta wrote: > > Whether the problem can be mitigated is what should be discussed, but the > > problem is objectively there. > > > Hi all, > > Like others, I like the *idea* of object keys, but worry about its >

Re: [PHP-DEV] [RFC] Allow object keys in arrays

2021-01-13 Thread Rowan Tommins
On 13/01/2021 09:16, Pierre R. wrote: Instead of trying to restrict types that can be used as keys, may be this should be the time to have enumerables, lists, maps, vectors, sets, types, dictionaries, ... in PHP standard library ? A third party tool such as PHP-DS should be part of core API ins

Re: [PHP-DEV] [RFC] Allow object keys in arrays

2021-01-13 Thread Ilija Tovilo
Hi Matthew On Wed, Jan 13, 2021 at 7:15 AM Matthew Brown wrote: > > This proposal is interesting, and I see why the enum proposal makes it > useful. > > Supporting this will mean a small amount of work for me (assuming it > passes) and other static analysis tools, but I don't want that to factor

Re: [PHP-DEV] [RFC] Allow object keys in arrays

2021-01-13 Thread Pierre R.
Le 13/01/2021 à 10:08, Rowan Tommins a écrit : On 12/01/2021 16:51, Marco Pivetta wrote: Whether the problem can be mitigated is what should be discussed, but the problem is objectively there. Hi all, Like others, I like the *idea* of object keys, but worry about its practical impact. A

Re: [PHP-DEV] [RFC] Allow object keys in arrays

2021-01-13 Thread Rowan Tommins
On 12/01/2021 16:51, Marco Pivetta wrote: Whether the problem can be mitigated is what should be discussed, but the problem is objectively there. Hi all, Like others, I like the *idea* of object keys, but worry about its practical impact. A few scatter-gun thoughts on possible approaches,

Re: [PHP-DEV] [RFC] Allow object keys in arrays

2021-01-12 Thread Matthew Brown
This proposal is interesting, and I see why the enum proposal makes it useful. Supporting this will mean a small amount of work for me (assuming it passes) and other static analysis tools, but I don't want that to factor into anyone's decision. I am curious, though, whether the scope of this RFC

Re: [PHP-DEV] [RFC] Allow object keys in arrays

2021-01-12 Thread Pierre R.
Le 12/01/2021 à 17:35, Ilija Tovilo a écrit : Hi Marco On Tue, Jan 12, 2021 at 5:19 PM Marco Pivetta wrote: On Mon, Jan 11, 2021, 15:29 Nikita Popov wrote: Hi internals, I would like to present a draft RFC for allowing object keys in arrays: https://wiki.php.net/rfc/object_keys_in_arrays

Re: [PHP-DEV] [RFC] Allow object keys in arrays

2021-01-12 Thread Larry Garfield
On Tue, Jan 12, 2021, at 11:53 AM, Andreas Leathley wrote: > On 12.01.21 17:51, Marco Pivetta wrote: > > Code written to deal with `array` in a generic way will no longer work > > when > > invoked through code paths that produce object keys: this is a general > > problem with widening types overall

Re: [PHP-DEV] [RFC] Allow object keys in arrays

2021-01-12 Thread Andreas Leathley
On 12.01.21 17:51, Marco Pivetta wrote: Code written to deal with `array` in a generic way will no longer work when invoked through code paths that produce object keys: this is a general problem with widening types overall, and is a clear BC break. If you look at levels of BC break, this is on

Re: [PHP-DEV] [RFC] Allow object keys in arrays

2021-01-12 Thread Marco Pivetta
Separate response for this one, sorry for the noise: On Tue, Jan 12, 2021, 17:35 Ilija Tovilo wrote: > Note that even minor PHP versions have historically not followed strict > semantic versioning. If we did, most PHP features would have to be pushed > back years given PHPs relatively slow relea

Re: [PHP-DEV] [RFC] Allow object keys in arrays

2021-01-12 Thread Marco Pivetta
Hey Ilija, On Tue, Jan 12, 2021, 17:35 Ilija Tovilo wrote: > > Definitely disagree here. Your existing code will continue to work fine > without changes. > Code written to deal with `array` in a generic way will no longer work when invoked through code paths that produce object keys: this is a

Re: [PHP-DEV] [RFC] Allow object keys in arrays

2021-01-12 Thread Ilija Tovilo
Hi Marco On Tue, Jan 12, 2021 at 5:19 PM Marco Pivetta wrote: > On Mon, Jan 11, 2021, 15:29 Nikita Popov wrote: > > > Hi internals, > > > > I would like to present a draft RFC for allowing object keys in arrays: > > https://wiki.php.net/rfc/object_keys_in_arrays > > Overall, this is something I

Re: [PHP-DEV] [RFC] Allow object keys in arrays

2021-01-12 Thread Marco Pivetta
Hi Nikita, On Mon, Jan 11, 2021, 15:29 Nikita Popov wrote: > Hi internals, > > I would like to present a draft RFC for allowing object keys in arrays: > https://wiki.php.net/rfc/object_keys_in_arrays > > The specification in the RFC is incomplete, and primarily focussed on what > impact this has