<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Talk Like A Duck: Tag opinion</title>
    <link>http://talklikeaduck.denhaven2.com/articles/tag/opinion</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>In Ruby, it's not the dog, it's the tricks!</description>
    <item>
      <title>The Perils of Ruby</title>
      <description>Charlie Nutter just published an article which assesses &lt;a href="http://headius.blogspot.com/2008/04/promise-and-peril-for-alternative-ruby.html"&gt;the various implementations of Ruby&lt;/a&gt;. In all it&amp;#8217;s a quite even-handed description coming from one of the main proponents of JRuby.
&lt;p&gt;Charlie talks about each implementation and describes the perils each faces.&lt;/p&gt;
&lt;p&gt;These seem to be days of crisis for Ruby.  With so many implementations compatibility is a challenge.  Particularly since Ruby lacks a formal specification.  The Rubinius developers have been working hard to address this by developing, RubySpecs, a set of &lt;a href="http://rubinius.lighthouseapp.com/projects/5089/specs-overview"&gt;rspec style specifications for Ruby&lt;/a&gt;.  Matz has also convened a regular meeting of Ruby implementors via irc.  The &lt;a href="http://ruby-design.pbwiki.com/Design20080421"&gt;first meeting took place last week,&lt;/a&gt;and one of the decisions taken was to make RubySpec the officially blessed set of tests to be used by all implementors.&lt;/p&gt;
&lt;blockquote class="pullquote"&gt;Compatibility is &lt;strong&gt;hard&lt;/strong&gt;. I&amp;#8217;m not talking a little hard, I&amp;#8217;m talking monumentally hard. Ruby is a very flexible, complicated language to implement, and it ships with a number of very flexible, complicated core class implementations. Very little exists in the way of specifications and test kits. &amp;#8211; Charles Nutter&lt;/blockquote&gt;
&lt;h2&gt;Is Ruby Forking?&lt;/h2&gt;
&lt;p&gt;Currently there are two major &amp;#8220;official&amp;#8221; versions of Ruby. Ruby 1.8, which is in use for most production purposes, and Ruby 1.9 which introduces new features (e.g. integrated support for strings with different encodings), new language features (e.g. new syntax for hash literals which allows actual parameters to methods taking an options hash as the last argument to look like keyword parameters), and some incompatibilities.&lt;/p&gt;
&lt;p&gt;As Charlie points out the peril here is that Rubyists have a hard time figuring out which Ruby to target.  Ruby 1.9 isn&amp;#8217;t yet ready for production, but even when it is, will the advantages outweigh the cost of the &amp;#8216;porting&amp;#8217; needed to get past the incompatibilities.&lt;/p&gt;
&lt;p&gt;Some implementations are attempting to bridge the gap. JRuby is taking on some 1.9 features while maintaining compatibility with 1.8.  The recent preview release of Ruby 1.8.7, also introduces some 1.9 features to the 1.8.x code base, albeit with some initial incompatibilities, which hopefully will be worked out. RubySpec should help this.&lt;/p&gt;
&lt;p&gt;MacRuby, on the other hand, is taking another approach to 1.9 features.  MacRuby is a new Apple implementation of Ruby which uses the Objective-C run-time as a platform, much as JRUby and IronRuby use the Java &lt;span class="caps"&gt;JVM&lt;/span&gt;, and Microsoft &lt;span class="caps"&gt;DLR&lt;/span&gt;, as platforms.&lt;/p&gt;
&lt;p&gt;One of the ways in which MacRuby exploits 1.9 is the way they are mapping the new hash literal syntax I just mentioned.  Let&amp;#8217;s look a bit at that new syntax.&lt;/p&gt;
&lt;p&gt;At the risk of offending the &amp;#8220;Rails isn&amp;#8217;t Ruby crowd&amp;#8221;, I&amp;#8217;m going to take an example from ActiveRecord, because Rails tends to use option hash parameters quite a bit.  In Ruby 1.8 I might code:&lt;/p&gt;
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;Book.find(:all, :order =&amp;gt; &amp;quot;title ASC&amp;quot;, :limit =&amp;gt; 10)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To get the first 10 books sorted by title.  The new Ruby 1.9 syntax allows this to be written alternatively as:&lt;/p&gt;
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="constant"&gt;Book&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;find&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="symbol"&gt;:all&lt;/span&gt;&lt;span class="punct"&gt;,&lt;/span&gt; &lt;span class="ident"&gt;order&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;title ASC&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;,&lt;/span&gt; &lt;span class="ident"&gt;limit&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt; &lt;span class="number"&gt;10&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Which is actually an identical call.  These &amp;#8220;keyword arguments&amp;#8221; are quite reminiscent of the Smalltalk-inspired syntax used in Objective-C. As I understand it, MacRuby will look at such a call, and turn it into an Objective-C message internally something like:&lt;/p&gt;
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_objective-c "&gt;[Book find: @selector(all) order: &amp;quot;title ASC&amp;quot; limit: 10]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;But this isn&amp;#8217;t exactly the same.  In Ruby one method can handle multiple optional keyword arguments which can appear (or not) in any order.  In Objective-C the message selectors find:order:limit, and find:limit:order would map to different methods.  When I asked Laurent Sansonetti about this on ruby-core, he said that the implementation would actually determine whether the receiving object understands :find:order:limit: and if not fall back to a more ruby-like call.  I&amp;#8217;m not sure how such a chicken-typed implementation will really stand up in practice, but I guess that time will tell.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m also not sure what the long-term implications of this are as Matz moves from 1.9 to 2.0 and perhaps starts defining new method definition syntax which provides syntactic sugar (at least) for handling &amp;#8220;keyword parameter&amp;#8221; hashes on the other side of the  invocation.&lt;/p&gt;
&lt;h2&gt;Platforms, Platforms, Platforms&lt;/h2&gt;
&lt;p&gt;As I said above, one way to characterize the various ruby implementations is by the platform each &amp;#8216;advocates&amp;#8217;.  Traditional &lt;span class="caps"&gt;MRI&lt;/span&gt; Ruby, and Ruby 1.9 run well on &lt;span class="caps"&gt;UNIX&lt;/span&gt; like platforms like Linux, &lt;span class="caps"&gt;OS X&lt;/span&gt;, and Solaris. Rubinius is building a new Ruby-based platform using ideas from Squeak and earlier Smalltalk implementations, although as far as I can tell, it&amp;#8217;s not following the Smalltalk philosophy of being an &amp;#8220;operating system&amp;#8221; on its own, IronRuby is really an attempt to optimize a Ruby implementation for Microsoft Platforms, while JRuby leverages the &lt;span class="caps"&gt;JVM&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;I can&amp;#8217;t help but think back to the early 1990s as a member of the Smalltalk community.  Smallalk had gained a fair bit of traction in the enterprise, particularly in industries such as finance and insurance where rapid application development was important. Java started to take the wind out of Smalltalk&amp;#8217;s sails.  I always considered the switch from Smalltalk to Java to be driven by factors such as the cost of entry for an individual programmer, but my old friend Dave Thomas (OTI&amp;#8217;s BigDave, not pragDave) points out that it was more a matter of companies like &lt;span class="caps"&gt;IBM&lt;/span&gt; (one of the main Smalltalk vendors by then) moving to Java as an anti-Microsoft platform. Java really took off in the enterprise after &lt;span class="caps"&gt;IBM&lt;/span&gt;, Sun, and others entered a kind of &lt;span class="caps"&gt;ABM&lt;/span&gt; treaty (Anyone But Microsoft)&lt;/p&gt;
&lt;p&gt;Ruby is in a different place than Smalltalk was at that time. Smalltalk was available from, and advocated by, a small number of vendors who sold it at a handsome price.  Two of the big Smalltalk implementations survive, &lt;span class="caps"&gt;IBM&lt;/span&gt;/VisualAge Smalltalk is still available from Instantiations &lt;a href="http://www.instantiations.com/VAST/purchase.html"&gt;at a four figure price&lt;/a&gt;. Cincom sells the latest version of VisualWorks Smalltalk, under a complex web of licensing options. Both of these &amp;#8220;compete&amp;#8221; with the open-source Squeak implementation.&lt;/p&gt;
&lt;p&gt;The environment has shifted out from under the big corporate providers of software development tooling like &lt;span class="caps"&gt;IBM&lt;/span&gt;, Sun and Microsoft. It&amp;#8217;s hard to see how to make big bucks selling development tools when so much is available under various open-source licenses for the cost of a download.&lt;/p&gt;
&lt;p&gt;Ruby has come out of today&amp;#8217;s open-software environment. It was conceived out of one man&amp;#8217;s desire for a language which he personally found pleasing, and grew within the open source community.  While I applaud and appreciate the support that Ruby has received from Sun, Microsoft, Apple, and other corporations, I can&amp;#8217;t help but feeling that some of the motivation is based on keeping control of the platform.&lt;/p&gt;
&lt;p&gt;These might be perilous times for Ruby, but I&amp;#8217;ve got confidence that the overall community will keep things from getting too far out of whack.&lt;/p&gt;
&lt;p&gt;Again, time will tell.&lt;/p&gt;</description>
      <pubDate>Sun, 27 Apr 2008 15:17:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:74c1c878-8e63-4058-a787-d9af613f2af7</guid>
      <author>Rick DeNatale</author>
      <link>http://talklikeaduck.denhaven2.com/articles/2008/04/27/the-perils-of-ruby</link>
      <category>ruby</category>
      <category>opinion</category>
      <trackback:ping>http://talklikeaduck.denhaven2.com/articles/trackback/496</trackback:ping>
    </item>
  </channel>
</rss>
