RE: ACTION 614-12: Smart Quotes

> 
> Note, many text editors will show matching ( ), [ ] and { } but not
> matching | and | and not matching « and », which was part of the
> motivation for my @{...} proposal.
> 
> «{ .... ~~{...}~~  ..... ~~{ ... }~~ ... }» would be OK by me, and would
> meet Mike Kay's goal of getting a non-ascii character into XPath (or
> XQuery) :D But overall sticking to ASCII will likely make life easier in
> the tech support world, even today.
> 

FWIW, I like the chevron approach, as it removes a lot of clutter that'd otherwise cloud the reader (I find the ~~~{..}~~~ utterly unreadable). That certain tools will need to catch-up is nothing new. A year ago, C# just introduced quoted interpolated strings (using $@"Hello {firstname}, {lastname}") and other than VS itself, no syntax highlighter supports it, yet nobody complains.
 
In addition, if this is going to be part of XPath (not just XQuery), it may end up being used in attributes in XSLT a lot, where the newlines get lost. Though I can't think of a suitable way around that.

I have one other concern: indentation. I believe in Perl that the first indent size is stripped from every line, to allow easier text formatting without having to resort to align to the first column, which can break the indentation flow of program code. I have not seen it in many other languages, but find it very useful, and it is simple:

let $b := books/book
return
    for $b in book
    return
        for $a in author
        return « Book title: « $b/title »
             § author: « $a »
             § role: « $a/role » »

Would output:

Book title: LOTR
§ author: Tolkien
§ role: original author

And not:

Book title: LOTR
            § author: Tolkien
            § role: original author

The rule could be (were this accepted), that the size of the first indent after the opening chevron determines the amount of stripped spaces. If additional indentation is needed, the user can indent beyond the current indentation. If indentation is less on following lines, this is ignored.

I think this is especially useful in combination with text-value-templates in XSLT, which don't appear in attributes, and are therefore susceptible for indentation-rot.

Cheers,
Abel

Received on Sunday, 13 September 2015 22:44:14 UTC