25 ms·
Funny. I almost dislike all of PHP but think that their choice of basic data structure is the one good thing. Computers are getting faster and faster and simpli
by thibran 6y ago
Funny. I almost dislike all of PHP but think that their choice of basic data structure is the one good thing. Computers are getting faster and faster and simplifying programming could be done to a whole new level. Clojure for example has a similar approach. Okay, PHP lacks contracts, but maybe PHP adds them in 20 years when the mainstream understands that they are great.
- kitsune_ 6y agoClojure's persistent collection types include List, Vector, Map, Set and you have namespaced keywords. In general, I don't see how you can compare the approach of Rich Hickey and Clojure to PHP to be honest...
- __jem 6y agoAlso, those collection types are backed by a number of concrete implementations.
- ashton314 6y agoI too dislike PHP, but this is one of the things I hate the most: this is like conflating addition and multiplication of types. Arrays and maps have separate use cases and very different trade-offs and PHP gives you no choice in the matter.
- tottenhm 6y agoIn fairness, it does give choices -- https://www.php.net/manual/en/spl.datastructures.php https://www.php.net/manual/en/spl.datastructures.php
- duskwuff 6y agoThe SPL data structures are widely considered a mistake. They're awkwardly designed, cannot be type-hinted, and often perform worse than pure-PHP alternatives.
- duckerude 6y agoFor me it didn't really simplify programming, it just added mental overhead. Every array I used was either strictly sequential or strictly a mapping, and the language did nothing to help me keep track of that. It also makes some potential niceties impossible. Python can give a special meaning to a negative index into a list, because it can never truly exist, but PHP has to treat it like a key and do a normal lookup.
- otabdeveloper4 6y agoComputers aren't getting faster. In fact, they're getting slower in real practice. (We've been trading off speed for safety and power consumption for years now.)