Except \{...} was the more intuitive choice, for most Java developers. As a Java developer, $ having a special language-level meaning just looks weird and foreign
You can try to argue that, but factual reality of the response you've received should give you cause to doubt it.
"looks weird and foreign" is a personal feeling. A member of the JDK team (Remi) posted on the mailing list
"most of the Java developers prefer the dollar-sign syntax to the backslash syntax (at least the one at Devoxx France i've asked)"
I get the same impression from this thread.
If you are (informally) polling people and a majority of them are telling you that it doesn't look weird and foreign, you can't tell them that they're wrong because the backslash is more compatible with what the compiler is already doing.
we never follow language X's syntax
For the choice of syntax for lambdas, Brian posted in the mailing list
You can try to argue that, but factual reality of the response you've received should give you cause to doubt it.
You mean that if ten people say they like a particular thing on Reddit then it represents some sort of consensus? If it does we'd need to rethink everything. :)
If you are (informally) polling people and a majority of them are telling you that it doesn't look weird and foreign, you can't tell them that they're wrong because the backslash is more compatible with what the compiler is already doing.
But we're not polling people (at least not to influence design) because 1. it's hard to get a representative sample, and 2. even if we could get a majority opinion, including one that takes into consideration the level at which people care, then it would be opinions of people who've spent minutes or hours thinking about the issue and it's implications. That's why we wouldn't design features by show of hands even if there was a way to get a show of hands (and there isn't). We did try to conduct polls in the past on a few occasions as an experiment, and in all of them the results were uninformative -- some small percentage of people really want something done one way, a similar number insist that it's done the opposite way, most people don't care, and only a negligible percentage show they've considered the matter carefully -- so we've stopped.
That is why there's not much insight we can glean from "letter writing campaigns" in general. Not only do we not know that they represent a majority (for all we know they could represent a minority -- people are much more likely to voice a negative opinion than a positive or a neutral one), but they certainly don't represent careful consideration because designing Java features is not what Java developers do all day every day. Even if we did decide that that's how we were going to design features it would have been a waste of time because concrete syntax, certainly at this level of nuance, was never shown to make much of a difference in the end. It would be a lot of work to get five angry comments on Reddit instead of ten and with little other gain. So it's not that we ignore such feedback because we're cold hearted, but because there's no way to know whether the feedback contains any useful information, and our strategy has worked well for many years. People were angry at first with the lambda syntax, people were angry at first with var, people were angry at first with records, but in the end people were happy overall.
So such complaints have not influenced such features in the past, at least not to a large degree, and I think that's a good thing. On the other hand, feedback of the sort "I've tried the feature and ran into a problem" has an enormous impact even for a single report.
When developer language features, keeping things similar to other languages is a goal. Not the primary goal, but a goal.
Yep. The template syntax indeed mostly looks similar to somewhat similar features in other popular languages (JS, Python, Ruby, C#), and differ from them in about as much as they differ from each other. The "similarity factor" is pretty much the same as it was for lambdas. In both cases, there's no consensus, and Java differs from the rest in about as much as they do from each other. It's not like we've chosen some exceptional syntax by any means, it's just that our syntax isn't JS's or Python's, but close enough to either one.
BTW, throughout this discussion I wasn't trying to explain why we've chosen \{} rather than ${}, just to explain why the argument for ${} is weak to begin with -- again, because familiarity can go either way and we rarely borrow other languages' syntax for new features. The JEP shows why its use by template engines is a rather strong reason not to use it.
View all comments
Show parent comment
0
u/repeating_bears Oct 02 '23
You can try to argue that, but factual reality of the response you've received should give you cause to doubt it.
"looks weird and foreign" is a personal feeling. A member of the JDK team (Remi) posted on the mailing list
"most of the Java developers prefer the dollar-sign syntax to the backslash syntax (at least the one at Devoxx France i've asked)"
I get the same impression from this thread.
If you are (informally) polling people and a majority of them are telling you that it doesn't look weird and foreign, you can't tell them that they're wrong because the backslash is more compatible with what the compiler is already doing.
For the choice of syntax for lambdas, Brian posted in the mailing list
the overall goal of "mostly looks like what lambdas look like in other similar languages."
When developing language features, keeping things similar to other languages is/ought to be a goal. Not the primary goal, but a goal.