Proposal: Embedded Expressions for String Statements

Vilya Harvey vilya.harvey at gmail.com
Sun Mar 15 15:27:08 PDT 2009


2009/3/15 Jeremy Manson <jeremy.manson at gmail.com>

> Hi Stefan,
>
> I'm sure this is obvious to everyone who isn't me, but I'm not sure
> what the big win is here.  Basically, it looks to me as if you save a
> very small number of keystrokes:
>

The big win is readability, in my opinion. If you have variables or
expression intermingled with your string, it's harder to tell what the
result will be. In particular it's harder to tell which columns things will
be starting or ending on, so aligning things nicely across multiple lines is
harder.

That said, I don't think this should be part of the language. There's
already the MessageFormat class, which covers a lot of the use cases. It's
not perfect by any means, but as it's not embedded in the language syntax
there's nothing to prevent you writing a replacement.

Also (maybe) of note: Python had this feature for a long time but it's been
*removed* from the latest version of the language (3.0).

Vil.



More information about the coin-dev mailing list