<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Ruby DSLs aren&#8217;t</title>
	<atom:link href="http://kbullock.ringworld.org/2008/11/23/ruby-dsls-aren-t/feed/" rel="self" type="application/rss+xml" />
	<link>http://kbullock.ringworld.org/2008/11/23/ruby-dsls-aren-t/</link>
	<description>god, tech, and other geekery</description>
	<lastBuildDate>Thu, 29 Jul 2010 15:16:02 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Farrel</title>
		<link>http://kbullock.ringworld.org/2008/11/23/ruby-dsls-aren-t/comment-page-1/#comment-50</link>
		<dc:creator>Farrel</dc:creator>
		<pubDate>Sun, 23 Nov 2008 10:56:00 +0000</pubDate>
		<guid isPermaLink="false">/2008/11/23/ruby-dsls-aren-t#comment-50</guid>
		<description>&lt;p&gt;The query language of Sequel (http://sequel.rubyforge.org) is a lot closer to what you want&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
items.filter(:price + 100 &lt; 200).sql
  #=&gt; &quot;SELECT * FROM items WHERE ((price + 100) &lt; 200)&quot;

items.filter((:price + 100 &lt; 200) &amp; (:price * 100 &lt;= 200)).sql
  #=&gt; &quot;SELECT * FROM items WHERE (((price + 100) &lt; 200) AND ((price * 100) &lt;= 200))&quot;
&lt;/code&gt;&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<p>The query language of Sequel (<a href="http://sequel.rubyforge.org" rel="nofollow">http://sequel.rubyforge.org</a>) is a lot closer to what you want</p>

<pre><code>
items.filter(:price + 100 < 200).sql
  #=> "SELECT * FROM items WHERE ((price + 100) < 200)"

items.filter((:price + 100 &lt; 200) &amp; (:price * 100 &lt;= 200)).sql
  #=> "SELECT * FROM items WHERE (((price + 100) &lt; 200) AND ((price * 100) < = 200))"
</code></code></pre>]]></content:encoded>
	</item>
	<item>
		<title>By: Andreas</title>
		<link>http://kbullock.ringworld.org/2008/11/23/ruby-dsls-aren-t/comment-page-1/#comment-51</link>
		<dc:creator>Andreas</dc:creator>
		<pubDate>Sun, 23 Nov 2008 10:56:00 +0000</pubDate>
		<guid isPermaLink="false">/2008/11/23/ruby-dsls-aren-t#comment-51</guid>
		<description>&lt;p&gt;It seems to me you&#039;re simply making an argument by example: &quot;this snippet I consider a DSL, this snippet I don&#039;t consider a DSL, and since the second snippet is Ruby, Ruby doesn&#039;t do DSLs&quot;. I think you need to have a definition (or maybe just an informal description) of what you think a DSL is to have a meaningful discussion.&lt;/p&gt;

&lt;p&gt;Furthermore, I think you need to discern between internal and external DSLs (as per http://www.martinfowler.com/bliki/DomainSpecificLanguage.html). I&#039;m guessing doing external DSLs is just as hard in both languages. You may argue you like internal DSLs in LISP better, but in my book, internals DSLs in Ruby are much more readable and human friendly (admitted, Datamapper may not be the best example).&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>It seems to me you&#8217;re simply making an argument by example: &#8220;this snippet I consider a DSL, this snippet I don&#8217;t consider a DSL, and since the second snippet is Ruby, Ruby doesn&#8217;t do DSLs&#8221;. I think you need to have a definition (or maybe just an informal description) of what you think a DSL is to have a meaningful discussion.</p>

<p>Furthermore, I think you need to discern between internal and external DSLs (as per <a href="http://www.martinfowler.com/bliki/DomainSpecificLanguage.html)" rel="nofollow">http://www.martinfowler.com/bliki/DomainSpecificLanguage.html)</a>. I&#8217;m guessing doing external DSLs is just as hard in both languages. You may argue you like internal DSLs in LISP better, but in my book, internals DSLs in Ruby are much more readable and human friendly (admitted, Datamapper may not be the best example).</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin</title>
		<link>http://kbullock.ringworld.org/2008/11/23/ruby-dsls-aren-t/comment-page-1/#comment-52</link>
		<dc:creator>Kevin</dc:creator>
		<pubDate>Sun, 23 Nov 2008 10:56:00 +0000</pubDate>
		<guid isPermaLink="false">/2008/11/23/ruby-dsls-aren-t#comment-52</guid>
		<description>&lt;p&gt;@Farrel: I&#039;ve used Sequel as well, and while I think it&#039;s a better implementation of the concept, it still requires horrible global monkeypatching to achieve it. It&#039;s still not a DSL under my definition, because it doesn&#039;t actually introduce syntax.&lt;/p&gt;

&lt;p&gt;@Andreas: I only mean to deal with internal DSLs here. And maybe I am arguing from example, but the definition I propose is basically this: an internal DSL, as distinct from an API, introduces new syntax to express a solution naturally in the language of the problem domain. An API might also use method and class (or property and procedure) names from the problem domain, and it should, but unless it defines new syntax, it&#039;s not a DSL.&lt;/p&gt;

&lt;p&gt;And again, I don&#039;t advocate DSLs over well-designed APIs, or vice versa. Nor do I advocate Lisp over Ruby on these grounds. I just want us to be clear on definitions.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Farrel: I&#8217;ve used Sequel as well, and while I think it&#8217;s a better implementation of the concept, it still requires horrible global monkeypatching to achieve it. It&#8217;s still not a DSL under my definition, because it doesn&#8217;t actually introduce syntax.</p>

<p>@Andreas: I only mean to deal with internal DSLs here. And maybe I am arguing from example, but the definition I propose is basically this: an internal DSL, as distinct from an API, introduces new syntax to express a solution naturally in the language of the problem domain. An API might also use method and class (or property and procedure) names from the problem domain, and it should, but unless it defines new syntax, it&#8217;s not a DSL.</p>

<p>And again, I don&#8217;t advocate DSLs over well-designed APIs, or vice versa. Nor do I advocate Lisp over Ruby on these grounds. I just want us to be clear on definitions.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: stefano</title>
		<link>http://kbullock.ringworld.org/2008/11/23/ruby-dsls-aren-t/comment-page-1/#comment-53</link>
		<dc:creator>stefano</dc:creator>
		<pubDate>Sun, 23 Nov 2008 10:56:00 +0000</pubDate>
		<guid isPermaLink="false">/2008/11/23/ruby-dsls-aren-t#comment-53</guid>
		<description>&lt;p&gt;@Kevin:&lt;/p&gt;

&lt;p&gt;in your post, you write: &quot;exhibitions and run-time wouldn&#039;t be variables&quot;. So what if you need to store the table&#039;s name in a variable? How would your DSL look like in this case?
My Lisp is a bit rusty :-)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Kevin:</p>

<p>in your post, you write: &#8220;exhibitions and run-time wouldn&#8217;t be variables&#8221;. So what if you need to store the table&#8217;s name in a variable? How would your DSL look like in this case?
My Lisp is a bit rusty <img src='http://kbullock.ringworld.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin</title>
		<link>http://kbullock.ringworld.org/2008/11/23/ruby-dsls-aren-t/comment-page-1/#comment-54</link>
		<dc:creator>Kevin</dc:creator>
		<pubDate>Sun, 23 Nov 2008 10:56:00 +0000</pubDate>
		<guid isPermaLink="false">/2008/11/23/ruby-dsls-aren-t#comment-54</guid>
		<description>&lt;p&gt;@stefano: I don&#039;t quite understand the question. You don&#039;t need a DSL to store a table name in a variable:&lt;/p&gt;

&lt;p&gt;&lt;pre&gt;&lt;code&gt;
(let table-name &quot;exhibitions&quot;
  ; ...
  )
; or just...
(define table-name &quot;exhibitions&quot;)
&lt;/pre&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;[dialect: Scheme]&lt;/em&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@stefano: I don&#8217;t quite understand the question. You don&#8217;t need a DSL to store a table name in a variable:</p>

<p><pre><code>
(let table-name "exhibitions"
  ; ...
  )
; or just...
(define table-name "exhibitions")
</code></pre></p>

<p><em>[dialect: Scheme]</em></p>]]></content:encoded>
	</item>
	<item>
		<title>By: Sam Smoot</title>
		<link>http://kbullock.ringworld.org/2008/11/23/ruby-dsls-aren-t/comment-page-1/#comment-55</link>
		<dc:creator>Sam Smoot</dc:creator>
		<pubDate>Sun, 23 Nov 2008 10:56:00 +0000</pubDate>
		<guid isPermaLink="false">/2008/11/23/ruby-dsls-aren-t#comment-55</guid>
		<description>&lt;p&gt;Kevin, I&#039;m sympathetic to your argument. Honestly, I look at some code these days, someone says &quot;Look, it reads like English!&quot;, and I respond &quot;So what? Is it loosely-coupled? Is it an inherited/mixed-in mess?&quot;&lt;/p&gt;

&lt;p&gt;Javascript doesn&#039;t read like English, and somehow, I don&#039;t have any trouble being productive there.&lt;/p&gt;

&lt;p&gt;But you&#039;re going about this all wrong.&lt;/p&gt;

&lt;p&gt;&quot;It&#039;s still not a DSL under my definition, because it doesn&#039;t actually introduce syntax.&quot;&lt;/p&gt;

&lt;p&gt;The problem isn&#039;t DSL here. The problem is you can&#039;t arbitrarily redefine software engineering terms to mean what you think they should.&lt;/p&gt;

&lt;p&gt;I think cars should have six wheels. Therefore vehicles without six wheels aren&#039;t cars.&lt;/p&gt;

&lt;p&gt;It doesn&#039;t work like that.&lt;/p&gt;

&lt;p&gt;Finders have been claimed to be a DSL in ActiveRecord that this shouldn&#039;t be up for question.&lt;/p&gt;

&lt;p&gt;The problem with :conditions isn&#039;t that it&#039;s a String. It&#039;s that it&#039;s a leaky abstraction. It subverts the entire point of an O/R Mapper in the first place. Leaky abstractions are not good things. This leak is most convenient in scenarios with complex queries, but then again, it&#039;s the same scenario where it falls down most.&lt;/p&gt;

&lt;p&gt;DataMapper &quot;supports&quot; the same leak. It&#039;s not because it&#039;s a great feature. It&#039;s because robust abstractions for query mechanisms are *hard*. Especially so if you&#039;re fixated on avoiding the more traditional Query mechanisms found in libraries like Hibernate.&lt;/p&gt;

&lt;p&gt;I agree, I&#039;m not a big fan of the Symbol Operators these days. It&#039;s a struggle to find a balance between robust APIs and something people will actually use.&lt;/p&gt;

&lt;p&gt;I&#039;m feeling rather disenfranchised with the whole &quot;beauty&quot; ideal these days. None of the Ruby O/RMs are especially beautiful. Compromises have to be made.&lt;/p&gt;

&lt;p&gt;BTW, a DSL may be your only API. Or it could be just one of your interfaces making up your API. The two are not synonymous. You can have an API without a DSL.&lt;/p&gt;

&lt;p&gt;Anyways, Internal/External DSLs... not terms redefine-able at will. ;-)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Kevin, I&#8217;m sympathetic to your argument. Honestly, I look at some code these days, someone says &#8220;Look, it reads like English!&#8221;, and I respond &#8220;So what? Is it loosely-coupled? Is it an inherited/mixed-in mess?&#8221;</p>

<p>Javascript doesn&#8217;t read like English, and somehow, I don&#8217;t have any trouble being productive there.</p>

<p>But you&#8217;re going about this all wrong.</p>

<p>&#8220;It&#8217;s still not a DSL under my definition, because it doesn&#8217;t actually introduce syntax.&#8221;</p>

<p>The problem isn&#8217;t DSL here. The problem is you can&#8217;t arbitrarily redefine software engineering terms to mean what you think they should.</p>

<p>I think cars should have six wheels. Therefore vehicles without six wheels aren&#8217;t cars.</p>

<p>It doesn&#8217;t work like that.</p>

<p>Finders have been claimed to be a DSL in ActiveRecord that this shouldn&#8217;t be up for question.</p>

<p>The problem with :conditions isn&#8217;t that it&#8217;s a String. It&#8217;s that it&#8217;s a leaky abstraction. It subverts the entire point of an O/R Mapper in the first place. Leaky abstractions are not good things. This leak is most convenient in scenarios with complex queries, but then again, it&#8217;s the same scenario where it falls down most.</p>

<p>DataMapper &#8220;supports&#8221; the same leak. It&#8217;s not because it&#8217;s a great feature. It&#8217;s because robust abstractions for query mechanisms are *hard*. Especially so if you&#8217;re fixated on avoiding the more traditional Query mechanisms found in libraries like Hibernate.</p>

<p>I agree, I&#8217;m not a big fan of the Symbol Operators these days. It&#8217;s a struggle to find a balance between robust APIs and something people will actually use.</p>

<p>I&#8217;m feeling rather disenfranchised with the whole &#8220;beauty&#8221; ideal these days. None of the Ruby O/RMs are especially beautiful. Compromises have to be made.</p>

<p>BTW, a DSL may be your only API. Or it could be just one of your interfaces making up your API. The two are not synonymous. You can have an API without a DSL.</p>

<p>Anyways, Internal/External DSLs&#8230; not terms redefine-able at will. <img src='http://kbullock.ringworld.org/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin</title>
		<link>http://kbullock.ringworld.org/2008/11/23/ruby-dsls-aren-t/comment-page-1/#comment-56</link>
		<dc:creator>Kevin</dc:creator>
		<pubDate>Sun, 23 Nov 2008 10:56:00 +0000</pubDate>
		<guid isPermaLink="false">/2008/11/23/ruby-dsls-aren-t#comment-56</guid>
		<description>&lt;p&gt;@Sam Smoot: Thanks for your (extensive) comments, and please don&#039;t read this as a knock against DataMapper&#8212;the work you guys are doing on it is impressive. I&#039;ll respond to just one point you made:&lt;/p&gt;

&lt;blockquote&gt;The problem is you can&#039;t arbitrarily redefine software engineering terms to mean what you think they should.
&lt;/blockquote&gt;

&lt;p&gt;Well, for one thing, I&#039;m not the only one who has come to this definition: see the comments &lt;a href=&quot;http://www.oreillynet.com/onlamp/blog/2007/05/the_is_it_a_dsl_or_an_api_ten.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; (also linked in the original post). Think about it: for it to be a domain-specific &lt;em&gt;language&lt;/em&gt;, it has to be a discernibly different &lt;em&gt;language&lt;/em&gt; within the host language, not just a special vocabulary.&lt;/p&gt;

&lt;p&gt;Secondly, the term was sufficiently ill-defined before it was adopted by Rubyists&#8212;and since then the waters have been muddied much further by people bandying the term about without really understanding it. A lot of Ruby interfaces are written in a DSLish &lt;em&gt;style&lt;/em&gt;, and that&#039;s fine, but calling these things DSLs doesn&#039;t make them such.&lt;/p&gt;

&lt;p&gt;Thirdly, sure I can ;p That is, if a term is thrown around without sufficient definition to advance conversation in the industry, I actually have a &lt;em&gt;responsibility&lt;/em&gt; to define the term as I use it, and as I see it best defined. Creating (or co-opting) new jargon without need and without a solid definition doesn&#039;t help us move the state of the art forward.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Sam Smoot: Thanks for your (extensive) comments, and please don&#8217;t read this as a knock against DataMapper&mdash;the work you guys are doing on it is impressive. I&#8217;ll respond to just one point you made:</p>

<blockquote>The problem is you can&#8217;t arbitrarily redefine software engineering terms to mean what you think they should.
</blockquote>

<p>Well, for one thing, I&#8217;m not the only one who has come to this definition: see the comments <a href="http://www.oreillynet.com/onlamp/blog/2007/05/the_is_it_a_dsl_or_an_api_ten.html" rel="nofollow">here</a> (also linked in the original post). Think about it: for it to be a domain-specific <em>language</em>, it has to be a discernibly different <em>language</em> within the host language, not just a special vocabulary.</p>

<p>Secondly, the term was sufficiently ill-defined before it was adopted by Rubyists&mdash;and since then the waters have been muddied much further by people bandying the term about without really understanding it. A lot of Ruby interfaces are written in a DSLish <em>style</em>, and that&#8217;s fine, but calling these things DSLs doesn&#8217;t make them such.</p>

<p>Thirdly, sure I can ;p That is, if a term is thrown around without sufficient definition to advance conversation in the industry, I actually have a <em>responsibility</em> to define the term as I use it, and as I see it best defined. Creating (or co-opting) new jargon without need and without a solid definition doesn&#8217;t help us move the state of the art forward.</p>]]></content:encoded>
	</item>
</channel>
</rss>

