Re: [apps-discuss] Question about URI template and expansion of an empty list

Erik Wilde <dret@berkeley.edu> Mon, 08 April 2013 05:41 UTC

Return-Path: <dret@berkeley.edu>
X-Original-To: apps-discuss@ietfa.amsl.com
Delivered-To: apps-discuss@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 6680621F91C9 for <apps-discuss@ietfa.amsl.com>; Sun, 7 Apr 2013 22:41:13 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.599
X-Spam-Level:
X-Spam-Status: No, score=-6.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, RCVD_IN_DNSWL_MED=-4]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LOYleRZvhj0W for <apps-discuss@ietfa.amsl.com>; Sun, 7 Apr 2013 22:41:12 -0700 (PDT)
Received: from cm03fe.IST.Berkeley.EDU (cm03fe.IST.Berkeley.EDU [169.229.218.144]) by ietfa.amsl.com (Postfix) with ESMTP id B198521F91BC for <apps-discuss@ietf.org>; Sun, 7 Apr 2013 22:41:12 -0700 (PDT)
Received: from 99-38-249-227.lightspeed.sntcca.sbcglobal.net ([99.38.249.227] helo=[192.168.1.97]) by cm03fe.ist.berkeley.edu with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (auth plain:dret@berkeley.edu) (envelope-from <dret@berkeley.edu>) id 1UP4pH-0003gu-Ad; Sun, 07 Apr 2013 22:41:12 -0700
Message-ID: <51625870.8000906@berkeley.edu>
Date: Sun, 07 Apr 2013 22:41:04 -0700
From: Erik Wilde <dret@berkeley.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130328 Thunderbird/17.0.5
MIME-Version: 1.0
To: apps-discuss@ietf.org
References: <CALcybBBXFDvAp1xpbi4=55Gq0QbfbTH7TV=1MTko7nNdtt-5WQ@mail.gmail.com> <CALcybBBcCTh8+RVWp5UW+2-s9EdKxdoeGdcq6+yGrGJk1nzP0w@mail.gmail.com>
In-Reply-To: <CALcybBBcCTh8+RVWp5UW+2-s9EdKxdoeGdcq6+yGrGJk1nzP0w@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 7bit
Subject: Re: [apps-discuss] Question about URI template and expansion of an empty list
X-BeenThere: apps-discuss@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: General discussion of application-layer protocols <apps-discuss.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/apps-discuss>
List-Post: <mailto:apps-discuss@ietf.org>
List-Help: <mailto:apps-discuss-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 08 Apr 2013 05:41:13 -0000

hello francis.

On 2013-04-07 13:38 , Francis Galiegue wrote:
> On Fri, Apr 5, 2013 at 8:39 PM, Francis Galiegue <fgaliegue@gmail.com> wrote:
>> Let us say that there is a variable called "list", whose value is an empty list:
>> list = []
>> Now let us have this template:
>> X{.list}
>> Should the expansion be "X" or "X."? And, more importantly, why?
> Any insights? I have read the spec by and large (RFC 6570) and still
> cannot figure it out...

https://github.com/dret/uritemplate-test/blob/master/spec-examples-by-section.json 
(line 234) says it's "X", but i am really interested in the "why" 
explanation as well. http://tools.ietf.org/html/rfc6570#section-3.2.5 
says that "for each defined variable in the variable-list, append '.' to 
the result string and then perform variable expansion", and i cannot 
find any text saying that an empty list is considered to be undefined. i 
have read the spec recently and never looked at this particular case, 
but without looking at the test cases i would have said it has to be 
expanded to "X." and not "X".

cheers,

dret.

-- 
erik wilde | mailto:dret@berkeley.edu  -  tel:+1-510-2061079 |
            | UC Berkeley  -  School of Information (ISchool) |
            | http://dret.net/netdret http://twitter.com/dret |