4 ms·
I believe that comma thing was added recently.
by vbezhenar 3y ago
I believe that comma thing was added recently.
- awelxtr 3y agoYup, as recent as 1996: "A trailing comma may appear after the last expression in an array initializer and is ignored" https://titanium.cs.berkeley.edu/doc/java-langspec-1.0/10.doc.html#11358 https://titanium.cs.berkeley.edu/doc/java-langspec-1.0/10.do...
- twic 3y agoThe comma thing is inherited from C and has always been there. Newer bits of array-like syntax, like varargs and array literals in annotations, do not allow trailing commas.
- rightbyte 3y agoI have this feeling the C comma operator was a accident from making function calls work in the beginning. After doing some hobby languages of my own I have come to realize many features are kinda automatic and accidental when writing languages, in a way other programming almost never is.
- ghusbands 3y agoYou may be thinking of javascript, which has added various kinds of trailing comma over the years, though arrays had them from the start. See https://stackoverflow.com/a/67793166 https://stackoverflow.com/a/67793166
- cxr 3y ago[flagged]
- vbezhenar 3y agoDid you ask yourself this question before you wrote this comment?
- cxr 3y agoTo answer your question: no, I didn't. It doesn't make sense to—I'm not here saying anything like, "I believe it's because X" without knowing whether X is true or not. If you think otherwise, explain how. (I have now answered your question. If you respond, how about doing so in the form of an answer to mine—and not evading it with another question?)
- vbezhenar 3y agoI bothered to comment because I write Java for 15 years and I thought that my knowledge was relevant to this topic. I’m not going to check every my comment with reference documentation. In this particular case my memory failed me and I was quickly corrected and downvoted, so no harm was done, I guess, other than few people spending few minutes, for which I feel sorry, but not very much.