String literals in Java 7: version 1.2
rssh at gradsoft.com.ua
rssh at gradsoft.com.ua
Wed Mar 18 03:53:48 PDT 2009
> The things I miss in Java strings are:
>
> 1. Embedding expressions, e.g. in JavaFX you can write "The answer is
> {answer ? "Yes" : "No"}". In the example the part inside the {} is
> evaluated and replaced by its value, if that value isn't a string then
> it is converted to a string automatically.
Simple case - works now.
boolean x = true;
String answer = (x ? "yes" : "no");
Complex case:
Create special syntax for template processing inside strings - I guess
this can be a library issue.
We have jsr223. May be good ideaa is adding helper methods, which process
string via choosed language interptreter, i.e.
s.scriptEval("velocity",binding);
.... but - from other side we can't receive binding between names and
values automatically for now.
So, will think. For me, approach is interesting, but I have more
questions than answers.
>
> 2. Easy internationalisation, e.g. in JavaFX you can write
> ##"Favourites" and the compiler internationalises your code and
> creates a properties file which you then edit for the different
> locales ("Favourites" = "Favorites")
>
I guess this can be nice small new proposal, if think about ## as not part
of literal, but unary operator.
Btw - interessting, why nobody fire 'simple operator overloading' proposal
yet ?
> I am not saying that your other extensions to Java Strings are not
> good suggestions, just that I miss these more. It would also be nice
> to be similar to JavaFX, since the two are likely to be used together.
>
>
More information about the coin-dev
mailing list