Hacker News new | ask | show | jobs
by mkl 998 days ago
The confusion is that the order of the key and value can be reversed, and commas are optional, so there's no way to tell at a glance what e.g. the value associated with:bar is.
2 comments

>the order of the key and value can be reversed

This is the case with any hash-map in any language, modulo some of them making certain keys illegal.

But "string":"string" can be reversed in pretty much any language's hash-map.

>here's no way to tell at a glance what e.g. the value associated with:bar is.

You've certainly constructed and formatted a hash-map that is a little tricky to understand, but 1> this combination of key and value types is going to be pretty rare in the wild and 2> to the extent it exists, people would format it to be easier to parse, either by adding commas or newlines.

> the order of the key and value can be reversed

That's not true. What you're seeing here is a map where [1 2 3] is the key for the value :baz