Re: [VOTE] ImmutableIterable (immutable, rewindable, allows any key&repeating keys)

From: Date: Thu, 17 Jun 2021 13:52:17 +0000
Subject: Re: [VOTE] ImmutableIterable (immutable, rewindable, allows any key&repeating keys)
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-114929@lists.php.net to get a copy of this message
On Wed, Jun 16, 2021, at 12:09 PM, Levi Morrison via internals wrote:
> > Over half of the objections are to functionality, over half to unspecified reasons,
> 
> I support people choosing not to directly respond with their
> unspecified reasons, but if anyone is open to sharing I would
> appreciate them doing so. I agree with Nikita that the concept is
> useful, and with some refinement it could be more acceptable to
> voters. If we know more about these "unspecified reasons" then perhaps
> we can improve something for them as well.
> 
> A guess: they don't really want unproven data structures going into
> core, well, because you see the state of some (many) of the SPL data
> structures.

While I like the idea of an immutable collection, and the performance boost seems useful, this
proposal seems to go about it in a sloppy way.

1) Iterable doesn't seem like the right "family" for this.  It is iterable, but so
are lots of other things.

2) I... have never seen anyone in PHP use "pairs" as a concept.  I have no idea what
they're doing here.

3) The JsonSerialize seems out of place.  It may make sense from another angle, but it just sorta
appears out of nowhere here.

It almost feels like what you actually want is an immutable Dictionary class.  Such would naturally
be iterable, countable, serializing makes some sense, a fromIterable() method would make sense, etc.
 That I could get behind, potentially, although it also runs into the exciting question of type
restrictions and thus generics, which is where list type discussions go to die. :-)

So it's not the concept I'm against; the angle of attack here feels sloppy and coming at
the problem from the wrong angle.

--Larry Garfield


Thread (10 messages)

« previous php.internals (#114929) next »