4 ms·
In the JEP (https://openjdk.org/jeps/430 https://openjdk.org/jeps/430) there is a bunch of prior art: C# $"{x} plus {y} equals {x + y}" Vis
by capableweb 3y ago
In the JEP (https://openjdk.org/jeps/430 https://openjdk.org/jeps/430) there is a bunch of prior art:
C# $"{x} plus {y} equals {x + y}"
Visual Basic $"{x} plus {y} equals {x + y}"
Python f"{x} plus {y} equals {x + y}"
Scala s"$x plus $y equals ${x + y}"
Groovy "$x plus $y equals ${x + y}"
Kotlin "$x plus $y equals ${x + y}"
JavaScript `${x} plus ${y} equals ${x + y}`
Ruby "#{x} plus #{y} equals #{x + y}"
Swift "\(x) plus \(y) equals \(x + y)"
Is any of those actually better? You have a non-existing better suggestion that works in the same cases they outline in the JEP?
I think the following is the main part to keep in mind:
> For Java, we would like to have a string composition feature that achieves the clarity of interpolation but achieves a safer result out-of-the-box, perhaps trading off a small amount of convenience to gain a large amount of safety.
- shortrounddev2 3y agoYes, all of those except swift are better
- deleted 3y ago[deleted]
- mongol 3y agoBikeshedding of the noblest kind. It is all subjective.
- therealdrag0 3y agoI’d say valuing shorter syntax is better which is subjective, but then measuring it is objective. Requiring 3 chars per variable is silly when many languages only require 1
- anonair 3y agoI agree that $ is more common and causes less visual friction, but what I like about \{} is that on my keyboard they are three keys adjacent to each other.