<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>jvoorhis comments on Urlang</title>
    <link>http://www.jvoorhis.com/</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>jvoorhis comments</description>
    <item>
      <title>"Urlang" by jvoorhis</title>
      <description>&lt;p&gt;Some weeks ago, after discovering &lt;a href="http://rack.rubyforge.org/"&gt;Rack&lt;/a&gt;, I took it upon myself to experiment with my own anti-framework in Ruby, using existing libraries whenever possible and filling in the blanks as I go. A vital piece of most web frameworks is the dispatcher &amp;#8211; the module that delegates web requests to application code.&lt;/p&gt;


The basic premise of my design is to encode common data structures within the path of a url, and to lookup the appropriate action in a dispatch table. I don&amp;#8217;t have a working dispatcher yet, but I do have this:
&lt;pre&gt;&lt;code&gt;
irb(main):002:0&amp;gt; UrlParser.parse("/foo/1,2,3/meep=fleem;fliffl=mumble,grumble/")
=&amp;gt; [["foo"], ["1", "2", "3"], {"meep"=&amp;gt;["fleem"], "fliffl"=&amp;gt;["mumble", "grumble"]}]
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;The simple language uses a slash to separate values, a comma to group them into a list, and equals and semi-colon together to create a hash. The values are returned as a list.&lt;/p&gt;


The next step is to determine the semantics of how an action is selected. My tastes would be satisfied by a very simple form of pattern matching, with this approximate syntax, mixing literals and types:
&lt;pre&gt;&lt;code&gt;
register(:module =&amp;gt; PostsController, :action =&amp;gt; :show,
         :path =&amp;gt; ['posts', Integer], :method =&amp;gt; GET)
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Further refinements to the path language might include recognizing ints and floats, and distinguishing between array and scalar values.&lt;/p&gt;


	&lt;p&gt;If you find the idea interesting, or even terrible, I&amp;#8217;d love to hear your thoughts on both the path language and the dispatching semantics.&lt;/p&gt;


	&lt;p&gt;p.s. No, I&amp;#8217;m not actually calling this &amp;#8220;Urlang&amp;#8221;.&lt;/p&gt;

</description>
      <pubDate>Wed, 30 May 2007 11:56:00 NZST</pubDate>
      <guid>&lt;a href="/articles/2007/05/30/urlang"&gt;Urlang&lt;/a&gt;</guid>
      <link>&lt;a href="/articles/2007/05/30/urlang"&gt;Urlang&lt;/a&gt;</link>
    </item>
  </channel>
</rss>
