Re: [PHP-DEV] Making stdClass iterable

2019-01-14 Thread Benjamin Morel
> `stdClass` can't die due to a lot of backwards compatibility in existing code (wordpress loves it) I, personally, would LOVE to see PHP break things on each release of a major version! I fail to see how upgrading could be painful, with a good changelog and the right E_DEPRECATED notices for a

Re: [PHP-DEV] Making stdClass iterable

2019-01-14 Thread Marco Pivetta
On Mon, Jan 14, 2019 at 4:09 PM Benjamin Morel wrote: > > We should never have added stdClass. > > Why not deprecate it then, instead of extending it and giving it more > legitimacy? > This would remove some of the "2 ways of doing the same thing", such as > json_decode(). > > Ben > This.

Re: [PHP-DEV] Making stdClass iterable

2019-01-14 Thread Benjamin Morel
> We should never have added stdClass. Why not deprecate it then, instead of extending it and giving it more legitimacy? This would remove some of the "2 ways of doing the same thing", such as json_decode(). Ben On Mon, 14 Jan 2019 at 16:00, Nikita Popov wrote: > On Mon, Jan 14, 2019 at 3:48

Re: [PHP-DEV] Making stdClass iterable

2019-01-14 Thread Rowan Collins
On Mon, 14 Jan 2019 at 15:00, Nikita Popov wrote: > The way I see it, stdClass is basically an array in object notation (and > object passing semantics). It carries data in the form of key value pairs > and has no associated logic. The only things you can do with it are access > keys

Re: [PHP-DEV] Making stdClass iterable

2019-01-14 Thread Nikita Popov
On Mon, Jan 14, 2019 at 3:48 PM Rowan Collins wrote: > On Mon, 14 Jan 2019 at 11:57, Nikita Popov wrote: > >> Rather than implementing Traversable, I think it would be much better to >> implement IteratorAggregate and provide a proper getIterator() >> implementation. > > > I think adding

Re: [PHP-DEV] Making stdClass iterable

2019-01-14 Thread Rowan Collins
On Mon, 14 Jan 2019 at 14:48, Rowan Collins wrote: > Currently, it has no methods, and matches no type checks other than itself > and "object"; in a sense, it doesn't even have any properties, just the > ability to add them dynamically. To me, that makes sense: it's the > "classless object", the

Re: [PHP-DEV] Making stdClass iterable

2019-01-14 Thread Rowan Collins
On Mon, 14 Jan 2019 at 13:23, Craig Duncan wrote: > What about an array is more iterable than a stdClass object? > An array is the structure PHP provides to represent a list, or an ordered collection of arbitrary key-value pairs; an object, whether stdClass or otherwise, is neither of these

Re: [PHP-DEV] Making stdClass iterable

2019-01-14 Thread Rowan Collins
On Mon, 14 Jan 2019 at 11:57, Nikita Popov wrote: > Rather than implementing Traversable, I think it would be much better to > implement IteratorAggregate and provide a proper getIterator() > implementation. I think adding behaviour to stdClass is a precedent we should approach with extreme

Re: [PHP-DEV] Making stdClass iterable

2019-01-14 Thread Craig Duncan
On Sat, 12 Jan 2019 at 20:13, Dan Ackroyd wrote: > I think the correct long-term solution for this would be for us to > revisit the union type RFC (https://wiki.php.net/rfc/union_types) and > so be able to define a type like: > > type foreachable = object|iterable; > This argument makes sense

Re: [PHP-DEV] Making stdClass iterable

2019-01-14 Thread Craig Duncan
On Mon, 14 Jan 2019 at 11:57, Nikita Popov wrote: > Rather than implementing Traversable, I think it would be much better to > implement IteratorAggregate and provide a proper getIterator() > implementation. Objects that only implement Traversable are a PITA to work > with and lots of code

Re: [PHP-DEV] Making stdClass iterable

2019-01-14 Thread Nikita Popov
On Sat, Jan 12, 2019 at 8:39 PM Craig Duncan wrote: > Hi everybody > > I'd like to propose a change to stdClass so that it can satisfy the > iterable parameter/return type. > > Firstly I acknowledge that this isn't an ideal solution, but I think it > gets us to a better state than we're in

Re: [PHP-DEV] [RFC} Deprecate and Remove ext/wwdx

2019-01-14 Thread Christoph M. Becker
On 14.01.2019 at 12:46, Nikita Popov wrote: > On Mon, Jan 14, 2019 at 12:22 PM Christoph M. Becker > wrote: > >> On 14.01.2019 at 10:45, Nikita Popov wrote: >> >>> On Sun, Sep 16, 2018 at 6:49 PM Christoph M. Becker >>> wrote: >>> Finally, I hereby put the “Deprecate and Remove ext/wwdx”

Re: [PHP-DEV] [RFC} Deprecate and Remove ext/wwdx

2019-01-14 Thread Nikita Popov
On Mon, Jan 14, 2019 at 12:22 PM Christoph M. Becker wrote: > On 14.01.2019 at 10:45, Nikita Popov wrote: > > > On Sun, Sep 16, 2018 at 6:49 PM Christoph M. Becker > > wrote: > > > >> Finally, I hereby put the “Deprecate and Remove ext/wwdx” RFC[1] under > >> discussion. > >> > >> [1]

Re: [PHP-DEV] [RFC} Deprecate and Remove ext/wwdx

2019-01-14 Thread Christoph M. Becker
On 14.01.2019 at 10:45, Nikita Popov wrote: > On Sun, Sep 16, 2018 at 6:49 PM Christoph M. Becker > wrote: > >> Finally, I hereby put the “Deprecate and Remove ext/wwdx” RFC[1] under >> discussion. >> >> [1] > > Do you plan to move this

Re: [PHP-DEV] [RFC} Deprecate and Remove ext/wwdx

2019-01-14 Thread Nikita Popov
On Sun, Sep 16, 2018 at 6:49 PM Christoph M. Becker wrote: > Hi! > > Finally, I hereby put the “Deprecate and Remove ext/wwdx” RFC[1] under > discussion. > > [1] Do you plan to move this RFC forward to voting? I think during the