Re: [PHP-DEV] Adding `final class Deque` to PHP

2021-09-20 Thread Mike Schinkel
> On Sep 19, 2021, at 8:03 PM, tyson andre wrote: > > Hi internals, > > I've created a new RFC https://wiki.php.net/rfc/deque to add a `final class > Deque` > > This is based on the `Teds\Deque` implementation I've worked on > for the https://github.com/TysonAndre/pecl-teds PECL. With one cav

[PHP-DEV] (Planned) Straw poll: Naming pattern for `*Deque`

2021-09-20 Thread tyson andre
Hi internals, Because the naming choice for new datastructures is a question that has been asked many times, I plan to create another straw poll (Single transferrable vote) on wiki.php.net to gather feedback on the naming pattern to use for future additions of datastructures to the SPL, with th

Re: [PHP-DEV] Adding `final class Deque` to PHP

2021-09-20 Thread Rowan Tommins
On 20/09/2021 14:46, tyson andre wrote: The choice of global namespace maintains consistency with the namespace used for general-purpose collections already in the SPL I find this argument unconvincing. If the intention is for this to fit with existing classes in the SPL, it should be called

Re: [PHP-DEV] Adding `final class Deque` to PHP

2021-09-20 Thread Pierre
Le 20/09/2021 à 15:46, tyson andre a écrit : Hi Pierre, I'm not certain what you mean by "normalize". https://www.merriam-webster.com/dictionary/normalize mentions At least please try to make it serious, I think you understood what I meant. I'm in no place in arguing about technical details ab

Re: [PHP-DEV] RFC: Add `final class Vector` to PHP

2021-09-20 Thread tyson andre
Hi Peter Bowyer, > That is a fair point. Vector is an overloaded and common word. For me a > vector will always default to an entity characterized by a magnitude and a > direction, because that's what I learned and used for years. The next > definition I learned was the Numpy one. > > That for me

Re: [PHP-DEV] Adding `final class Deque` to PHP

2021-09-20 Thread tyson andre
Hi Pierre, > It seems that you are writing more than one RFC to add many data > structures. I love that you're doing that, but I suggest that you'd > normalize them all I'm not certain what you mean by "normalize". https://www.merriam-webster.com/dictionary/normalize mentions 1. "to make confo

Re: [PHP-DEV] Proposal: Adding an ARRAY_FILTER_REINDEX flag to array_values

2021-09-20 Thread Guilliam Xavier
On Sun, Sep 19, 2021 at 3:11 PM tyson andre wrote: > Hi internals, > > Currently, array_filter will always return the original keys. > This often requires an additional wrapping call of > array_values(array_filter(...)) to reindex the keys and return a list. > (or applications may not realize the

Re: [PHP-DEV] Proposal: Adding an ARRAY_FILTER_REINDEX flag to array_values

2021-09-20 Thread Marco Pivetta
On Mon, Sep 20, 2021 at 12:02 PM Eugene Sidelnyk wrote: > From my experience it is not that easy to locate bug like this. > Heyo, just a tip for you (and others in this thread), but if you use `vimeo/psalm` and declare a `list` for a type, then `array_filter()` that are missing an `array_values(

Re: [PHP-DEV] Proposal: Adding an ARRAY_FILTER_REINDEX flag to array_values

2021-09-20 Thread Eugene Sidelnyk
Hi, I myself faced such bugs because filter function preserves keys. From my experience it is not that easy to locate bug like this. In my case I rewrote solution in other way than it was originally written. Only later I realized that root cause was array_filter On Sun, Sep 19, 2021, 4:11 PM tyson

Re: [PHP-DEV] Adding `final class Deque` to PHP

2021-09-20 Thread Christian Schneider
Am 20.09.2021 um 10:36 schrieb Pierre : > Le 20/09/2021 à 02:03, tyson andre a écrit : >> I've created a new RFC https://wiki.php.net/rfc/deque to add a `final class >> Deque` > > It seems that you are writing more than one RFC to add many data structures. > I love that you're doing that, but I

Re: [PHP-DEV] Proposal: Adding an ARRAY_FILTER_REINDEX flag to array_values

2021-09-20 Thread Peter Bowyer
On Sun, 19 Sept 2021 at 14:12, tyson andre wrote: > What are your thoughts on adding `ARRAY_FILTER_REINDEX`, to ignore the > original int/string keys and replace them with `0, 1, 2, ...` > If it's measurably faster/more memory efficient than array_values(array_filter(...)) across a range of arra

Re: [PHP-DEV] RFC: Add `final class Vector` to PHP

2021-09-20 Thread Peter Bowyer
Hi Tyson, On Sat, 18 Sept 2021 at 16:46, tyson andre wrote: > 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, > an

Re: [PHP-DEV] Adding `final class Deque` to PHP

2021-09-20 Thread Pierre
Le 20/09/2021 à 02:03, tyson andre a écrit : Hi internals, I've created a new RFC https://wiki.php.net/rfc/deque to add a `final class Deque` Hello, It seems that you are writing more than one RFC to add many data structures. I love that you're doing that, but I suggest that you'd normaliz