Comments about URI Templates

As I said in an earlier email, I really like URI Templates.  I have two
questions/potential concerns however.:

#1.)  I can't help but think URI Templates is incomplete. I'd like to ask
why you didn't include something like the following three ways to extend it
(even though I otherwise dislike regex, if only required in rare cases they
can be a huge boon):
 
    pathId= "ABC-123"
    http://www.foo.com/{substring(pathId,3,3)}/                   -> /C-1/ 
    http://www.foo.com/{regex(pathId):^.*-(.*)$|xyz-$1}/    -> /xyz-123/ 
    http://www.foo.com/{javascript:DbLookupPath(pathId)}/   -> /whatever1/ 
    http://www.foo.com/{http://example.com/foo?value={pathId}}/   ->
/whatever2/ 
 
So I'm suggesting consideration for
 
1.) a set of builtin functions for extracting substrings, etc.
2.) support for scoped regex, and 
3.) support for javascript
4.) support for dereferencing http
 
HOWEVER, I do understand that it might be best to keep the scope and effort
required to implement small, so you might not want to tackle any of these
(just yet).  Which brings me to concern...

#2.) Referencing section 4.1, is says that "template-char"s are
"unreserved."  

=========================
4.1  Template Variables

   Template variables are the parameterized components of a URI
   Template, their representation is described below.  A template
   variable MUST match the template-var production.

    template-char = unreserved
    template-name  = 1*template-char
    template-var  = "{" template-name "}"
=========================

Does that mean that you can use *any* character as a template-char? IOW, you
can use any of these: [~!@#$%^&*()-_:;?/"']?  If so, wouldn't it be a good
idea to reserve those chars to be able to expand functionality of a template
in the future?  In addition, why isn't a template-char simply restricted to
[A-Za-z0-9_]?  And if I misunderstood the meaning of "template-char =
unreserved," please forgive me.

-Mike Schinkel
http://www.mikeschinkel.com/blogs/
http://www.welldesignedurls.org/

Received on Wednesday, 15 November 2006 18:25:49 UTC