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

C — the language he cites as inspiring the syntax — doesn't have "var" or "public," so you're arbitrarily choosing another language as the "starting point" and then insulting this language for not doing the same thing as the one you would have chosen. And in the years since C came about, square array literals have been pretty common (and curly-brace array literals are actually almost unheard-of)†, so that seems like a pretty reasonable deviation from C.

† Here is a not-remotely-exhaustive list of languages with square sequence literals: D, Objective-C, Python, Ruby, JavaScript, PHP, the whole ML family, Clojure. On the other hand, C didn't even traditionally have array literals — it just had a special curly-brace initializer syntax you could use with arrays as well as other aggregates.




To add to your list of languages with square-bracket array/list/vector initializers (see also [0]): Aikido, Coffeescript, E, F# (sorta, uses pipes too), Groovy, Haskell, Matlab, Nimrod, Postscript, Vimscript.

[0]: http://rosettacode.org/wiki/Arrays




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: