4 ms·
I'm glad to see other languages finally catching up to PHP. I'm joking (kind of) but after a lot of years of doing this, I've begun de-prioritizing pure abstrac
by zackmorris 7y ago
I'm glad to see other languages finally catching up to PHP. I'm joking (kind of) but after a lot of years of doing this, I've begun de-prioritizing pure abstractions and favoring the way that humans tend to do things on their own.
Technically this is along the lines of the worse-is-better philosophy. The single biggest cost in software development is friction. Performance, size, etc are all less important, because they become less important with each passing year as computers grow more powerful. And along those lines, I think that silly concepts like assigning letter names to drives in Windows, or having a paltry few registers in x86, made those architectures more accessible to the masses than the more generalized Unix and Mac platforms. Not that I completely agree with that, just, it's all I can come up with (other than cost and familiarity) for why people are so attached to worse-is-better paradigms.
Preserving insertion order has some small cost associated with it, but that's going to be dwarfed by the cost of bugs introduced when junior devs are surprised by unordered dictionaries. And the pedantic people can just use an unordered dictionary manually since they are already converting pure abstractions to whatever imperfect implementations are provided by languages anyway.
- harryf 7y ago> I'm glad to see other languages finally catching up to PHP Now if python could just implement PHP's date function the world would be a simpler place... ( https://simonwillison.net/2003/Oct/7/dateInPython/ https://simonwillison.net/2003/Oct/7/dateInPython/ )
- upofadown 7y ago>Performance, size, etc are all less important, because they become less important with each passing year as computers grow more powerful. That isn't as true as it once was. We are running up against fundamental limits and people are even starting to talk about the environmental impact of computing.
- masklinn 7y agoIt should be noted that the ordering of python dict occurred as a side-effect of a new implementation with better memory profile (and as good or better performances).
- acomjean 7y agoFor those that don't know PHP associated arrays are equivalent pythons dictionaries. They are implemented as an ordered map. https://www.php.net/manual/en/language.types.array.php https://www.php.net/manual/en/language.types.array.php Its pretty much the main data type used in php. Once you get used to it is pretty powerful for dynamic languages. They even have built in sorts: https://www.php.net/manual/en/array.sorting.php https://www.php.net/manual/en/array.sorting.php They are "simple arrays" that have numeric indexes, but I find those used less frequently. (They can morph into the key->value pair).
- tylerjwilk00 7y agoYour point got me thinking... PHP arrays may have been one of the "killer features" that lead to it taking hold of the web. It's so frictionless, powerful, and you can bend them to your will with ease.