Re: draft-gregorio-uritemplate-02.txt

I take this back.. allowing prefix and append to accept lists cannot
*completely* replace listjoin but it can come very close.

Here are the various list join examples I have in my test suite, along
with -prefix based alternatives (assuming we allow -prefix and -append
to allow list values

http://bitworking.org/news/{-listjoin|/|entry}
http://bitworking.org/news{-prefix|/|entry}

{-opt|/-/|categories}{-listjoin|/|categories}
{-opt|/-|categories}{-prefix|/|categories}

http://www.google.com/notebook/feeds/{userID}{-prefix|/notebooks/|notebookID}{-opt|/-/|categories}{-listjoin|/|categories}?{-join|&|updated-min,updated-max,alt,start-index,max-results,entryID,orderby}
http://www.google.com/notebook/feeds/{userID}{-prefix|/notebooks/|notebookID}{-opt|/-|categories}{-prefix|/|categories}?{-join|&|updated-min,updated-max,alt,start-index,max-results,entryID,orderby}

http://example.org/{foo}/{bar}{-opt|/|categories}{-listjoin|/|categories}?{-join|&|baz,tag}
http://example.org/{foo}/{bar}{-prefix|/|categories}?{-join|&|baz,tag}

The following templates, however, are only possible with listjoin...

{-listjoin|/|segments}
http://example.org/?d={-listjoin|,|points}&{-join|&|a,b}
http://example.org/?d={-listjoin|,|list0}&{-join|&|foo}
http://example.org/?d={-listjoin|&d=|points}

In each of the cases where -prefix can be used, the template is either
as complex or less complex than the -listjoin alternative.

Bottom line: while the listjoin method is still necessary, there is
definite benefit and little cost to allowing prefix and append to work
with list values.

Another issue: can we please shorten "-listjoin" to just "-list", the
extra four characters aren't really needed.

- James

James M Snell wrote:
> [snip]
>> ยง3.1: Values of variables should not be restricted. They should just be escaped when building the URI. The simplest model is to say each variable value is a list of (Unicode) strings. An empty list is treated as if the variable was undefined.
> 
> I think I agree with this.  Defining every replacement value as a list
> does not cause any significant additional complexity and avoids having
> to treat each replacement separately.  I mentioned in another note that
> it can also be used to eliminate the listjoin operation completely.
> 
>   a = ["1","2"]
>   b = ["3"]
>   c = ["4","5","6"]
>   d = ["7","8"]
>   e = ["9"]
>   f = ["11","12"]
> 
> {-prefix|/|a}{-prefix|/|b}{-prefix|/|c}{-opt|?|d,e}{-join|&|d,e}{-opt|#|f}{f}
> 
>   Expands to:
> 
>   /1/2/3/4/5/6?d=6&d=7&d=8#1112
> 
> The current alternative using listjoin and non-list values for prefix
> would be:
> 
> {-opt|/|a}{-listjoin|/|a}{-prefix|/|b}{-opt|/|c}{-listjoin|c|}{-opt|?|d,e}{-join|&|d,e}{-opt|#|f}{-listjoin||f}
> 
> Which is quite a bit more complex and significantly less intuitive
> [snip]

Received on Saturday, 1 December 2007 03:35:59 UTC