Proposal: Embedded Expressions for String Statements (original) (raw)

Reinier Zwitserloot reinier at zwitserloot.com
Sat Mar 21 03:11:42 PDT 2009


In most other languages, the backtick delimiter is used to force an
identifier (e.g. scala). Because java is bound to get this sooner
rather than later too, I strenously object to using backticks for this.

e.g:

public void for(String foo) { //look, a method named after a keyword! }

NB: Joe, will you be writing the proposal on this? You mentioned
something along these lines when you announced coin at http://blogs.sun.com/darcy/entry/project_coin

--Reinier Zwitserloot

On Mar 21, 2009, at 10:27, Stefan Schulz wrote:

Hm, no, not yet. If such Strings reside in a resource file, they obviusly cannot be handled by the compiler (as any constructed or externalized String wouldn't be). So one would still need to "evaluate" the localized String, passing the required context (i.e. variable bindings) to the evaluation routine. One could offer the parsing part the compiler is using as utility, though. In script languages like PHP, there is a system function "eval", which automatically binds all visible variables to the evaluation process. I am not sure whether such an approach would be viable in Java.

Stefan Mark Mahieu schrieb: Hi Stefan,

Do you have any thoughts about how this new form of String might be internationalized? Mark



More information about the coin-dev mailing list