Multiline string literals

Florian Weimer fweimer at bfk.de
Mon Aug 8 01:50:44 PDT 2011


* Rémi Forax:

> An why not using " ?
> why do we need a different syntax for single line and multiple lines 
> string literals ?

It's difficult to provide good error messages for unterminated
multi-line strings.  The quoting argument is not very persuasive to me;
I prefer occasional consistent quoting (as in XHTML and JSON) to rarely
required quoting magic (as in Markdown in YAML).  If you need quoting in
the latter scenario, it's often quite difficult to figure out how to do
it.

As another syntactic option, Lua uses [[string]], [=[string]=],
[==[string]==] and so on for multi-line strings, which can encode any
string without special quoting rules.

-- 
Florian Weimer                <fweimer at bfk.de>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99



More information about the coin-dev mailing list