2017-01-28 17:49 GMT+01:00 Georges.L <geol...@gmail.com>: > Hello Niklas, > > > > This something very pertinent that you noticed. Thanks you for pointing it > out. > > > > Q - “sounds like everything you want is typed arrays” > > A- It’s much more than simple typed arrays. I forgot to mention that those > “Collection” would be passed, like objects, by reference. Meaning to a > memory-optimized type as it does not make local copies of the variable. > > > > Q – “What's wrong with having it as object as long as it's implemented > efficiently” > > A – > > 1 It’s semantically much more appropriated. Collections of data is > becoming something actively used in php since those frameworks are born all > over. >
How is the active usage and how are frameworks related to making it not an object but something entirely new instead? > 2 An object IMO is not intended to be used as “array of others object”. > It’s a design issue following a lack of this variable type in php. > Why not? Previously you mentioned Traversable and Countable, which are both interfaces, you mentioned it should be passed like an object. > 3 It’s native to php, meaning that’ll be faster as its core-optimized, > especially with huge Collection of data. Doctrine users will understand > this sentence. > We also have built-in classes. Maybe you want to have a look at https://github.com/php-ds/extension? > 4 This will allows frameworks to make use of a native Collection, instead > of doing their own ones. Nowadays each framework are using their one > Collection object which is not standardized at all since they all make the > same use of the Collection. > > > > Now I agree with something: > > This will be.a.huge.work behind the scenes. Not only for Php developpers, > but also for testers, documenters, etc. > Apart from generics, efficient data structures are already implemented in https://github.com/php-ds/extension, so maybe we want to move that into core instead of starting from scratch here. > This could be a major point of interest for Php8, lot of things moved in > the good way since Php 7. We can keep going by improving the code's > semantic and evolve in the way of framework makers. > Why PHP 8? Because of the BC break? Having it as simple objects doesn't have any BC impact and would be perfectly fine in any PHP 7.x release. Regards, Niklas