by owlstuffing · 3y ago · 0 comments
STR.”Total: \{count}”
Could not get uglier.
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)"
And finally:
Java STR."\{x} plus \{y} equals \{x + y}"
It remember me the first proposed syntax for lambdas. Let's hope the next preview will fix that.
> trading off a small amount of convenience to gain a large amount of safety
1. https://github.com/manifold-systems/manifold/tree/master/man...
sigh
Java is my most ambivalent language. There's things I love, and things I hate, and when it's good it's really good, when it's bad ... Yuck.
That said, I do think Python went worse with f-strings. Would have loved to see Java look to Groovy for inspiration.