Timeline for Why does Java support brackets behind variables and even behind method signatures? [closed]
Current License: CC BY-SA 3.0
Post Revisions
15 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 13, 2014 at 13:47 | history | closed |
jwenting gnat CommunityBot Dan Pichelman |
Opinion-based | |
| May 13, 2014 at 11:47 | comment | added | user7043 |
@Izkata That idea is called "declaration mirrors usage" and it's the reasoning behind C's declaration syntax. But decades of experience have shown it to not work nearly as well in practice. It doesn't scale well to more complex types, it clashes with the (quite reasonable and common) mental model that a declaration is just type name, name, ...; and when you have prefix "type operators" like * in C, you need operator precedence for them which increases ambiguity (int *is[] vs int (*ps)[]).
|
|
| May 13, 2014 at 7:04 | review | Close votes | |||
| May 13, 2014 at 13:47 | |||||
| May 13, 2014 at 3:26 | comment | added | Izkata |
Since you'd typically use array indexes as foo[i], I'd argue declaring arrays as int foo[] makes a hell of a lot more sense than other ways around. It's also entirely clear which variable is an array, while int[] foo, bar is not. (Is it just foo or are both of them arrays?)
|
|
| May 12, 2014 at 21:57 | history | tweeted | twitter.com/#!/StackProgrammer/status/465974084027695105 | ||
| May 12, 2014 at 21:22 | comment | added | gnat | "A Wolf in Sheeps Clothing: C syntax to make developers comfortable" (from the horse's mouth) | |
| May 12, 2014 at 21:15 | answer | added | Random42 | timeline score: 3 | |
| May 12, 2014 at 21:13 | comment | added | Blrfl | If your grammar doesn't conform the the spec, it's not so nice. | |
| May 12, 2014 at 20:51 | comment | added | Jonathan E. Landrum | Java is part of the C ghetto. That's the answer to a lot of the mindbogglingly stupid things Java allows. | |
| May 12, 2014 at 20:34 | comment | added | gexicide | @Blrfl: True, I have edited it out ;). I was just writing a Java parser and that stuff ruined my nice grammar, so I was indeed quite upset. | |
| May 12, 2014 at 20:33 | review | First posts | |||
| May 12, 2014 at 20:49 | |||||
| May 12, 2014 at 20:33 | history | edited | gexicide | CC BY-SA 3.0 |
deleted 118 characters in body; edited title
|
| May 12, 2014 at 20:21 | comment | added | user7043 | If this is the worst idea in language design you have seen in decades, you either have a serious problem with hyperbole or you've not spent a lot of time on language design. | |
| May 12, 2014 at 20:21 | comment | added | Blrfl | This would be a much better question with the rant edited out. | |
| May 12, 2014 at 20:15 | history | asked | gexicide | CC BY-SA 3.0 |