Re: RFC: Add `final class Vector` to PHP
| From: | tyson andre | Date: | Sat, 18 Sep 2021 15:46:19 +0000 |
| Subject: | Re: RFC: Add `final class Vector` to PHP | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-116088@lists.php.net to get a copy of this message | ||
Hi Peter Bowyer,
> > > To echo Pierre, a Vector needs to be of a single guaranteed type.
> > > Yes, this gets us back to the generics conversation again, but I presume
> > (perhaps naively?) there are ways to address this question without getting
> > into full-blown generics.
> >
> > Yep, as you said, this type is mixed, just like the SplFixedArray,
> > ArrayObject, values of SplObjectStorage/WeakMap, etc.
> >
>
> Please rename your proposal as the use of the term "Vector" is confusing
> for people who use them in other languages. Much of the discussion so far
> has been around whether it's a Vector or what it should be; changing the
> proposed name will allow the discussion to focus on what you're proposing
> to add, not what others (myself included) would like to see added to PHP :)
Many of php's names are based on the naming choices in libraries made in C/C++.
So using https://cplusplus.com/reference/vector/vector/
for my RFC https://wiki.php.net/rfc/vector
seems like the most natural naming choice,
and would make it easier for people with backgrounds in that family of languages to find the
functionality they're looking for.
PHP already has a SplStack, SplQueue, etc, like C++'s
stack, queue,
etc..
I expect having a second Stack would be confusing and make it hard to remember which is
the efficient one.
(Especially since stacks typically don't include specialized resizing methods)
No alternative names have been suggested by you or them so far, as far as I remember, and 2 of those
responders seem to be saying they would vote no regardless of the choice of name (for reasons such
as wanting generic-like functionality, wanting immutability or built-in types, etc.).
PHP's already using List to refer to linked lists, and array in PHP already refers
to a hash table (including in ArrayObject).
So I expect a stronger objection to alternative names that I can think of.
Also, your comment is ambiguous. Are you saying that you personally object to the name,
or that you're fine with the name but think that the comments by Larry/Chris/Pierre in this
email thread are representative of voters.
- People who wouldn't find the name surprising wouldn't bother writing an email to
indicate a lack of surprise.
Thanks,
-Tyson