W3C home > Mailing lists > Public > uri@w3.org > November 2007

Re: draft-gregorio-uritemplate-02.txt

From: Michaeljohn Clement <mj@mjclement.com>
Date: Mon, 26 Nov 2007 23:16:59 -0800
Message-ID: <474BC46B.3070903@mjclement.com>
To: URI <uri@w3.org>

Manger, James H wrote:
> ยง3.4: Using a variable that is a list of strings in a template that
> expects a single string is undefined. The first 'join' example
> inserts (escaped) commas - but there is no explanation of where they
> came from.

The commas came from the variable: the value of 'data' is not a list, 
but a literal string "10,20,30".

                     +----------+--------------------+
                     | Name     | Value              |
                     +----------+--------------------+
                     | a        | foo                |
                     | b        | bar                |
                     | data     | 10,20,30           |
                     | points   | ["10","20", "30"]  |
                     | list0    | []                 |
                     | str0     |                    |
                     | reserved | :/?#[]@!$&'()*+,;= |
                     | u        | \u2654\u2655       |
                     | a_b      | baz                |
                     +----------+--------------------+

The table is ambiguous, some of these are to be interpreted as string 
values (including Unicode escaping), and two of them as lists using 
Python syntax, but the reader must intuit this by pure instinct.

Perhaps it would be clearer to quote all the strings, or add a column 
to the table indicating type, or just avoid Python syntax altogether:

     a        the string "foo"
     data     the string "10,20,30"
     points   a list containing the three strings "10", "20", and "30"
     list0    the empty list
     str0     the empty string
     u        the string consisting of U+2654 followed by U+2655

-- 
Michaeljohn Clement
Received on Wednesday, 28 November 2007 02:18:26 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 13 January 2011 12:15:37 GMT