[raw-string] indentation stripping

Florian Weimer fw at deneb.enyo.de
Fri Jun 15 04:46:12 UTC 2018

* Brian Goetz:

>  - Most multi-line strings will be code snippets of some sort (JSON,
> XML, SQL, Java, etc);

> There’s some reason to believe that calling .stripIndent() will be so
> common that it should be the default, rather than requiring users to
> invoke it every time.

These two statements are somewhat at odds because JSON, XML (at least
with a DTD/schema), SQL and Java do not have significant whitespace
outside their own string literals, so there is no strong reason to
strip whitespace before parsing the string.

I think it is very desirable to reconstruct the Java source location
(that contains the raw string literal) in case the application
encounters an error within the contents of the string literal.  I hope
that the run-time representation of string literals will include
sufficient information to recover at least the source position (line
number and some suitable offset for the first `), and possibly even
the class (from which the source file can be found using debugging

More information about the amber-spec-observers mailing list