PROPOSAL: Templated Construction Expressions (i.e., Expressions Embedded in Strings)

Per Bothner per at
Mon Mar 30 23:34:02 PDT 2009

On 03/30/2009 10:12 PM, rssh at wrote:
>> (The proposal to use """ for both open and closing delimiters
>> is very IDE-unfriendly.  Imagine trying to do syntax highlighting
>> and checking as the user is entering a program or makes a typo ...)
> But IDE-s ara adopted to groovy and scala now. (I.e. netbeans correctly
> parse and highlight groovy long strings).

The problem is parsing and highlighting programs as they're being
edited and that may at any given time be syntactically invalid.

Of course a compiler and an IDE *can* work with "unfriendly" syntax,
but some language syntax is going to be easier than others in
terms of error recovery and dealing with partial programs.

What should the IDE do when the uses types:

    String x = """|
(where | means the insertion point).

Should the IDE color the rest of the program with the color
for strings?  That is clearly bad.  Should it automatically
add the closing terminator, so you get:

    String x = """|"""

That's probably the test bet, though perhaps weird.  But what if
the user points the cursor at the first " and types <delete> 6 times?
What should the IDE do in between each <delete>?

There are all kinds of pragmatic questions when you have
delimited forms, and multi-line strings using """ as both
the start and ending delimiter makes it pretty nasty.
Through in template expressions that may contain nested
string literals and it becomes really nasty.

> And all major IDE-s will be
> adopted to new . So, this argument is not counted.

I'm afraid not.

I have talked with the NetBeans implementors specifically about the
syntax of templated and multiline strings in JavaFX.  We made
changes to the JavaFX syntax at their suggestion/request.
	--Per Bothner
per at

More information about the coin-dev mailing list