RE: ACTION 614-12: Smart Quotes

 
> How about <[ ]> <{ }> ? I like the fact that it retains the tradition of using
> angle brackets for switching between literal text and non-text information.
> “<[“ has vague connotations of CDATA sections, and <{ retains the “{“ which
> is associated with embedded expressions elsewhere in the language. And it’s
> visually clear.
> 
> let $json := <[ { “name”: { “first”:<{ $first }>,  “last”:<{ $last }> } ]>
> 

If used in an XML context, i.e. in XSLT with XP31, this would become

let $json := &lt;[ { “name”: { “first”: &lt;{ $first }>,  “last”: &lt;{ $last }> } ]>

I didn't see a decision in the minutes from yesterday, so I'm going to assume that the discussion is still open? If not, please ignore... ;)

Even if the syntax is going to be proposed only for XQ, it stands to reason that at some point it will adapted by XSLT processors, perhaps as a user option to support this syntax. It would be awkward to have the angle brackets syntax there.

What about a simpler syntax? I like the C# style with @"....". Quotes need to be escaped in C# with double quotes. But if we were to use @"..."@ such escaping is not needed. We could use the #-symbol for expressions inside the string. It is not as ubiquitous in json, css and other languages as $ or {. A # would open and close an expression, a double hash would be an escape. Since @ is only used with a following EQName, I think this can be made sound in EBNF.

This does not have the visual appearance of balancing brackets/parentheses, but still it stands out strong enough.

Another variant you may want to consider is a variant of the smiley-syntax. Something like (=....=). The equal sign has the mnemonic of "assign", it is balanced, easy to remember, and the current rules for places where the equal sign can be used is never just before or after a parenthesis.

Both these approaches are easy to type with any western or non-western keyboard.

Cheers,
Abel 

 

Received on Wednesday, 16 September 2015 07:11:39 UTC