Hacker News new | ask | show | jobs
by bebop 5229 days ago
I think they chose the [] for arrays and {} for dictionaries as that is the style that seems to be most popular right now. Python for instance uses this.
2 comments

When adding features to something, I tend to be a big fan of "when in Rome"[1]. If these were extensions to Python (or Ruby or JavaScript) then I would totally be for using '[' with arrays. As a C guy though, I would rather have seen them use '{' for NSArray and '[' for NSDictionary. Regardless, I'm glad to see this stuff added.

[1] http://en.wiktionary.org/wiki/when_in_Rome,_do_as_the_Romans...

It's already custom in objc to use {} for dicts and [] for arrays when printing them out, unless I'm misremembering. It also matches the use of those characters in JSON, so it seems natural to me.
And Perl. And Javascript. And Ruby. There's lots of precedent.