Hacker News new | past | comments | ask | show | jobs | submit login

> arrays being sorted maps has to be one of the worst design decisions.

I'm curious, why is that so bad? It tends to be a useful property of PHP arrays.

Also for webdevelopment, I/O is often the bottleneck. This code creates an array with 1 million items, each being 'a' and then loops over each value, changing them to 'b':

    $array = array_fill(0, 1000000, 'a');
    foreach ($array as $key => $value) {
       $array[$key] = 'b';
    }
It executes in 2ms on my machine.

How often do you need to create and change each element of a million item array? A roundtrip TCP/IP call to PostgreSQL is bound to be slower than that for most web servers.




It is also funny to see a JS developer criticise the architecture of PHP arrays specifically.

It does hint that perhaps bearjaws is (lucky for them!) too young to remember the mess that incomplete implementation of array/object duality got the JS world into.


Been programming both languages since 2008.


Right. Then you are too young (as a developer at least!) to remember. Except that Object.entries() is there to remind you. And two different for() enumeration syntaxes (for...in and for...of).

JS has an enormous amount of bad-design scar tissue.

I find it interesting that JS developers will forgive it all (global variables, iterables confusion, broken this handling, insane implicit number and int conversions, not to mention simple stuff like semicolon handling) and think PHP developers doing the same for theirs are inferior.

It's a classic example of fundamental attribution error.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: