(no title)
Noe2097 | 3 years ago
Over the 9 languages mentioned: 5 languages (inc. JVM ones like groovy and kotlin) are using `$`, 1 language (swift) is using `\`.
`\` is a pain to type on many keyboard layouts -- actually most but the US one. It seemed to me that `$` would have been a much more "conventional" choice.
This really makes me sad. It looks like the choice was made on purpose to be different.
kothar|3 years ago
layer8|3 years ago
kevincox|3 years ago
aardvark179|3 years ago
dmitriid|3 years ago
Too|3 years ago
qw|3 years ago
It's actually made worse because { and } also need special combinations.
To type \{X} I need to press
I know this is something we need to live with due to historical reasons, but I would prefer that new syntax is made simpler.v-erne|3 years ago
The ergonomic of \{X} is exactly the same on it as on my carbon x1, my keychron tls and four other keyboards I happen to have in my drawer.
Are You using modified Apple II like Rebecca Heineman or some kind of super small keyboard that looks like someone forgot to put all the keys in :) ?
Either way its on you not Java.
(Dont take this wrong way - this is an honest question - here in Poland almost all keyboard are backslash friendly and I would live to knowe where this is not the case)
lenkite|3 years ago
bberrry|3 years ago
spankalee|3 years ago
> For the syntax of embedded expressions we considered using ${...}, but that would require a tag on string templates (either a prefix or a delimiter other than ") to avoid conflicts with legacy code.
Can't the template processor expression itself function as the tag? Is STR."..." already legal now?
layer8|3 years ago
———
However, what they could have done instead is to use a syntax like
i.e. place the interpolated expressions outside of string literals. Slightly longer, but maybe more readable and typable, and currently invalid syntax. (The parentheses would be mandatory.)cs02rm0|3 years ago
nunobrito|3 years ago
It seems just as difficult to remember/useless as lambda expressions that look fine as vanity one-line expressions and then get difficult to write for most programmers.
We don't really need vanity innovation in the Java world. I would have asked for priority on the FX replacement to Swing, or support for running on ESP32 IoT devices as replacement to the Arduino platform.
Instead we get some weird looking syntax for what is basically a non-problem.
¯\_(ツ)_/¯
pdevr|3 years ago
If any of you design a language or a DSL, please, please - avoid the backslash - for the reasons stated above. Hard to type, introduces unseen problems, most will hate it. It (backslash) is unbecoming, of anything elegant.
SyrupThinker|3 years ago
jacobn|3 years ago
kaba0|3 years ago
In current Java you would have to escape \, so only “\\{val}” could have existed before.
kaba0|3 years ago
agumonkey|3 years ago
saagarjha|3 years ago