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 is the sticking point if this Vector allows mixed types which > include arrays or vectors. Store them inside a Vector and then you end up > with a matrix, a tensor and so-on in something identified as a Vector, > which is nonsense. Yes C++ does that [1]. Yes with generics it sort-of > makes sense. Numpy gets round it by calling the type `ndarray` and a vector > is a specialised one-dimensional array. > > If it's a high-performance array and that's the goal, call it hparray. Call > it a tuple. Call it a dictionary.
- `hparray`: I think putting high performance in any class name in core is a mistake, and generally poor naming choice, and will mislead users now or in the future. (unless it is literally an API client for a database or server that includes high performance in the server software's name) Benchmarks currently show it using less memory but some more time than `array`, and those benchmarks will change as opcache's internals or PHP's representation of `object`s or `array`s change. Which choice of data structure is highest performance would depend on the benchmark or needs of the application/library. - `tuple`: In mathematics, most references I've heard of to tuples are generally fixed sizes (n-tuples). In programming, python and C++ and various other languages use tuple to refer to a fixed-size (and immutable) data structure, making this naming choice extremely confusing. https://docs.python.org/3/tutorial/datastructures.html#tuples-and-sequences https://en.cppreference.com/w/cpp/utility/tuple > (In C++)Class template std::tuple is a fixed-size collection of heterogeneous values. - `dictionary` - Wikipedia refers to this as an associative array https://en.wikipedia.org/wiki/Associative_array which is the exact opposite of what my Vector RFC is proposing. So I don't consider any of those proposed names appropriate alternatives, and expect much, much stronger opposition to an RFC using that naming choice for this functionality. I expect opposition to any naming choice I propose; `Vector` is what I expect to have the least opposition. Thanks, Tyson -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php