OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

xdi message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Quoting string literals (including multiline)


Let's collect possible options for string literal syntax and discuss with attention to readability. This is mainly for X3 (or whatever our most human-readable format will be called) since JSON has only a single type of string literal and a single escape character, \. We do need faithful round-trip between our formats, or at least round-trip returning an acceptable canonicalization.


Choice of quote characters  e.g. allowing either double quotes or single quotes. The advantage is that double quotes can appear unescaped within a single-quoted string and vice versa. In many languages the two types of string are equivalent, in some languages double quoted strings undergo more substitution. XML attributes allow either single or double quotes. JSON only specifies double quotes.

Triple quoting: A string that starts with three quote characters continues until it ends with three quote characters, removing need to escape quotes, newlines, etc. Easy to type and parse.  Examples: Python, Scala

Here document   You explicitly designated an end string, then everything up until that end string occurs is one literal. XML CDATA is one example; do we accept CDATA as input? Here docs originated with Unix shell, and Perl and others have it.

Automatic parse-time concatenation of adjacent string literals: One advantage is that continuation lines do not have to break indentation pattern. However, newlines are not included so you have to specify these explicitly.





[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]