W3C home > Mailing lists > Public > uri@w3.org > July 2011

Re: uri templates: {?var}

From: Roy T. Fielding <fielding@gbiv.com>
Date: Thu, 14 Jul 2011 18:55:46 -0700
Cc: URI <uri@w3.org>
Message-Id: <4528A73D-14FF-4DE9-B383-70262E1A2129@gbiv.com>
To: "Manger, James H" <James.H.Manger@team.telstra.com>
On Jul 14, 2011, at 6:26 PM, Manger, James H wrote:
> Not having to know the state of the URI being built is a very MINOR benefit for the (few) developers of template processor libraries. An {?var} operator that looks for any '?' in that state is a MAJOR benefit to (many many) template authors.

It isn't a minor benefit -- it means that each expression can be
expanded in parallel instead of sequentially from left to right,
that the template processor does not need to include a URI parser,
and that each expression can be considered in isolation and thus
not be subject to several factorial more potential test cases.

> If a template should use
> "foo?literal=here&var={var}" instead of "foo?literal=here{?var}"
> why not use 
> "foo?var1={var1}&var2={var2}" instead of "foo{?var1,var2}"
> and drop the whole operator?

Because foo{?var1,var2} is the common case and far easier to read.

> The draft 05 text will be nasty for authors that are modifying a template that uses "{?a,b,c,x,y,z}". To add a fmt=xml parameter they have to change all the other parameters: "?fmt=xml&a={a}&b={b}&c={c}&x={x}&y={y}&z={z}".

If an author has the ability to modify the template, they
would modify it to be {?fmt,a,b,c,x,y,z}.  If a template has
a hundred different variables that can't be described in a
more rational way like an explode variable, then the site sucks.
The explode syntax was intended to make that case a little less
ugly, but I really don't care to turn templates into yet another
way to design bad sites.

....Roy
Received on Friday, 15 July 2011 01:56:22 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 15 July 2011 01:56:23 GMT