Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Compared to what?


Compared to almost any other language I've used - it's awkward, and unnecessarily verbose because it mixes in how one would define an associative array/hashmap/object as the only way to use an array. It does not distinguish a traditional list from an associative array.


> how one would define an associative array/hashmap/object as the only way to use an array.

Well JS goes even further in relation to hashmap/object (e.g. you can iterate object properties as if the object was a relational array, because, well, in JS an object is an array). In PHP, on the other hand, you can't refer to $object['property']

Hovever I have to agree with you when it comes to the overlapping between relational arrays vs "simple" arrays, the fact that all arrays are actually relational introduces weirdness, for example sometimes when you replace an array element you end up with elements that are not in the order you expect them to be.


But you specifically said its array syntax is annoying.

What is "annoying" about:

    ["foo", $bar, BAZ, 1, 2, 3]




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

Search: