W3C home > Mailing lists > Public > public-rdf-comments@w3.org > February 2012

Re: Turtle quotation idea unicode

From: David Robillard <d@drobilla.net>
Date: Wed, 29 Feb 2012 15:20:42 -0500
Message-ID: <1330546842.23771.8.camel@verne.drobilla.net>
To: Henry Story <henry.story@bblfish.net>
Cc: public-rdf-comments@w3.org
On Sat, 2012-02-25 at 22:42 +0100, Henry Story wrote:
> On 25 Feb 2012, at 22:28, David Robillard wrote:
> 
> > On Fri, 2012-02-24 at 16:11 +0100, Henry Story wrote:
> >> I noticed that there are two long quotation mechanism that do the same thing """ and '''
> >> 
> >> Now that unicode tooling is widespread - it was certainly not so 15 years ago - why not make
> >> one of those be a pure unicode string? This is something I was thinking would be useful in Scala
> >> for regexps for example, where having to decode the number of backslashes makes a nice notation
> >> unreadable. I'll suggest it in Scala too. But it seems that this would be useful here too.
> > 
> > I am confused.  Turtle documents are by definition always UTF-8.  What
> > do you propose would be the difference between """ and '''?
> 
> STRING_LITERAL1 ::= "'" ( ( [^'\\\n\r] ) | ECHAR | UCHAR )* "'" 
> STRING_LITERAL2 ::= '"' ( ( [^\"\\\n\r] ) | ECHAR | UCHAR )* '"' 
> ECHAR ::= "\\" [tbnrf\\\"'] 
> UCHAR ::= ( "\\u" HEX HEX HEX HEX ) 
>         | ( "\\U" HEX HEX HEX HEX HEX HEX HEX HEX ) 
>  
> So my proposal would have been something like this
> 
> [89s] STRING_LITERAL_LONG1 ::= "'''" ( ( "'" | "''" )? ( [^'] ) )* "'''" 
> [90s] STRING_LITERAL_LONG2 ::= '"""' ( ( '"' | '""' )? ( [^\"\\] | ECHAR | UCHAR ) )* '"""' 
> 
> ie: one of the does just unicode.

Oh, you mean one does not have any escapes except one for the trailing
separator.  Somewhat analogous to single and double quotes in the Unix
shell (variables are not expanded in single quotes strings).

Would be nice for literals in languages that have escapes (e.g.
Javascript or whatever).

A better use for single quotes than wasting them without reason (what
isn't?) but it'd wreck Sparql compatibility.

-dr
Received on Wednesday, 29 February 2012 20:21:08 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:59:30 UTC