Re: Delimiters for String Templates (the ultimate Bike Shed!)

I think you have the order swapped for (4).  It should be:
> 1.  <<[ ... ]>>  and <<{ ... }>>
> 2.   <[ ... ]>   and  <{ ... }>
> 3.  @@[ ... ]@@  and @@{ ... }@@
> 4.  <[" ... "]>  and  <{ ... }>
Here are the relevant SymbolHound counts:

1.
   ]>>      9 results
   <<{      4 results

2. 

   ]>      596 results  (occurs frequently in HTML and XML)
   <{      236 results

3.
   ]@@     0 results
   @@{     7 results 

4. 
   "]>     20 results
   <{      236 results


My preference is 4.

* I think 2 will require escaping too often (HTML, XML)
* 3 is unlike the existing constructors (<!—, <e>abc</e>, <?pi, <![CDATA[, etc.).  
* I like 4 and 1 but prefer 4 over 1 because I think the quote will imply that the expression produces a string.  Consider these two examples:

     let $x := <<[
            background-color: <<{$color}>>;
            margin: 10px 5px;
     ]>>
     return ….

     versus

     let $x := <["
            background-color: <{$color}>;
            margin: 10px 5px;
     "]>
     return ….
 
I find the second one more intuitive since it looks more like a string literal than the first one.  I also find <{ ... }> more aesthetically pleasing than <<{ … }>>.  

Thanks,
Josh


> On Sep 22, 2015, at 1:04 PM, Robie, Jonathan <jonathan.robie@emc.com> wrote:
> 
> In today's telcon, we were able to create an action plan for string templates [1], but we did not make a decision on the strings to be used in the delimiters.  The following candidates were discussed.  On each line, the first pair of delimiters indicates the start and end of a string template, and the second indicate the start and end of an expression within a string template:
> 1.  <<[ ... ]>>  and <<{ ... }>>
> 2.   <[ ... ]>   and  <{ ... }>
> 3.  @@[ ... ]@@  and @@{ ... }@@
> 4.   <{ ... }>   and  <[" ... "]>
> 
> We need to pick a set of strings to use as delimiters. Some considerations:
> 
> 1. These strings will frequently be used to create structured output, so it is helpful to choose strings that make it easy to see the start and end of each region, and that allow a programmer to use nesting to indicate the hierarchy.
> 
> 2. XML, HTML, and JSON are likely to be particularly common use cases, we should choose characters that can be used to create readable queries that produce these formats. http://symbolhound.com/ <http://symbolhound.com/> lets you find contexts in which character sequences can occur in various languages (thanks, Josh!).
> 
> 3. No matter what characters we use, it's easy to create output that uses these characters using variables or strings.
> 
>   let $start := "<{"
>   let $end  := "}>"
>   return
>      <{ $start, foo, $end, }>
> 
> or:
> 
>   <{ "<{", foo, "}>", }>
> 4. We cannot use character sequences that would change the interpretation of existing queries. One candidate, <<", was dismissed on these grounds.
> 
> 5. This is the ultimate bike shed. We want to make all outstanding decisions in next week so that we can implement this proposal.
> 
> Jonathan
> 
> [1] https://lists.w3.org/Archives/Public/public-xsl-query/2015Sep/0070.html <https://lists.w3.org/Archives/Public/public-xsl-query/2015Sep/0070.html>

Received on Tuesday, 22 September 2015 21:21:25 UTC