- From: Robie, Jonathan <jonathan.robie@emc.com>
- Date: Tue, 29 Sep 2015 14:59:00 +0000
- To: Liam Quin <liam@w3.org>
- CC: Public Joint XSLT XQuery XPath <public-xsl-query@w3.org>
> I could live with either <<[...]>> <<{...}>> or @@. > > A possible advantage of << is that Perl (and bash) uses it: I could also live with either of these. Suppose we had to choose between the following options: 1. <<[ ]>>, <<{ }>> 2. @@[ ]@@, @@{ }@@ 3. ~~[ ]~~, ~~{ }~~~ 4. ``[ ]``, ``{ }`` Here's what they look like for our examples. This is a known bike shed, but here's my impression: - I find that the angle brackets in #1 tend to cause figure/ground problems among angle brackets produced for HTML or XML. - I find that @@ is kind of ugly, and the @@ shouts much more loudly than the difference between { and [, so it winds up being less readable than I would prefer. - I find that ~~[ ]~~, ~~{ }~~ is more readable and somewhat less irritating than the other two. - I find ``[ ]`` ``{ }`` the most readable of all. Here's what they look like for our examples. 1. <<[ ]>>, <<{ }>> declare function local:prize-message($a) as xs:string { <<[Hello <<{$a.name}>> You have just won <<{$a.value}>> dollars! <<{ if ($a.in_ca) then <<[Well, <<{$a.taxed_value}>> dollars, after taxes.]>> else "" }>>]>> } Here's what it looks like if we produce HTML instead of text: declare function local:prize-message($a) as xs:string { <<[ <div> <h1>Hello <<{$a.name}>></h1> <p>You have just won <<{$a.value}>> dollars!</p> <<{ if ($a.in_ca) then <<[ <p>Well, <<{$a.taxed_value}>> dollars, after taxes.</p> ]>> else "" }>> </div> ]>> } Here's what it looks like if we produce JSON: declare function local:prize-message($a) as xs:string { <<[ { "greetings" : "Hello!", "value" : $a.value <<{ if ($a.in_ca) then <<[, "taxed_value", <<{ $a.taxed_value }>> ]>> else "" }>> } ]>> } 2. @@[ ]@@, @@{ }@@ declare function local:prize-message($a) as xs:string { @@[Hello @@{$a.name}@@ You have just won @@{$a.value}@@ dollars! @@{ if ($a.in_ca) then @@[Well, @@{$a.taxed_value}@@ dollars, after taxes.]@@ else "" }@@]@@ } Here's what it looks like if we produce HTML instead of text: declare function local:prize-message($a) as xs:string { @@[ <div> <h1>Hello @@{$a.name}@@</h1> <p>You have just won @@{$a.value}@@ dollars!</p> @@{ if ($a.in_ca) then @@[ <p>Well, @@{$a.taxed_value}@@ dollars, after taxes.</p> ]@@ else "" }@@ </div> ]@@ } Here's what it looks like if we produce JSON: declare function local:prize-message($a) as xs:string { @@[ { "greetings" : "Hello!", "value" : $a.value @@{ if ($a.in_ca) then @@[, "taxed_value", @@{ $a.taxed_value }@@ ]@@ else "" }@@ } ]@@ } 3. ~~[ ]~~, ~~{ }~~ declare function local:prize-message($a) as xs:string { ~~[Hello ~~{$a.name}~~ You have just won ~~{$a.value}~~ dollars! ~~{ if ($a.in_ca) then ~~[Well, ~~{$a.taxed_value}~~ dollars, after taxes.]~~ else "" }~~]~~ } Here's what it looks like if we produce HTML instead of text: declare function local:prize-message($a) as xs:string { ~~[ <div> <h1>Hello ~~{$a.name}~~</h1> <p>You have just won ~~{$a.value}~~ dollars!</p> ~~{ if ($a.in_ca) then ~~[ <p>Well, ~~{$a.taxed_value}~~ dollars, after taxes.</p> ]~~ else "" }~~ </div> ]~~ } Here's what it looks like if we produce JSON: declare function local:prize-message($a) as xs:string { ~~[ { "greetings" : "Hello!", "value" : $a.value ~~{ if ($a.in_ca) then ~~[, "taxed_value", ~~{ $a.taxed_value }~~ ]~~ else "" }~~ } ]~~ } 4. ``[ ]``, ``{ }`` declare function local:prize-message($a) as xs:string { ``[Hello ``{$a.name}`` You have just won ``{$a.value}`` dollars! ``{ if ($a.in_ca) then ``[Well, ``{$a.taxed_value}`` dollars, after taxes.]`` else "" }``]`` } Here's what it looks like if we produce HTML instead of text: declare function local:prize-message($a) as xs:string { ``[ <div> <h1>Hello ``{$a.name}``</h1> <p>You have just won ``{$a.value}`` dollars!</p> ``{ if ($a.in_ca) then ``[ <p>Well, ``{$a.taxed_value}`` dollars, after taxes.</p> ]`` else "" }`` </div> ]`` } Here's what it looks like if we produce JSON: declare function local:prize-message($a) as xs:string { ``[ { "greetings" : "Hello!", "value" : $a.value ``{ if ($a.in_ca) then ``[, "taxed_value", ``{ $a.taxed_value }`` ]`` else "" }`` } ]`` }
Received on Tuesday, 29 September 2015 14:59:50 UTC