<?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: MacRuby</title>
	<atom:link href="http://jens.mooseyard.com/2008/03/macruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://jens.mooseyard.com/2008/03/macruby/</link>
	<description>Little boxes made of words, by Jens Alfke</description>
	<lastBuildDate>Wed, 10 Mar 2010 11:49:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Laurent Sansonetti</title>
		<link>http://jens.mooseyard.com/2008/03/macruby/comment-page-1/#comment-2342</link>
		<dc:creator>Laurent Sansonetti</dc:creator>
		<pubDate>Mon, 03 Mar 2008 20:33:38 +0000</pubDate>
		<guid isPermaLink="false">http://mooseyard.com/Jens/2008/03/macruby/#comment-2342</guid>
		<description>&lt;blockquote&gt;
If Ruby converts such arguments into a hash, both of those attributes would be lost.
&lt;/blockquote&gt;

Definitely, and this is why RubyCocoa wasn&#039;t able to use this syntax for Objective-C selector messaging. In 1.9, hash keys are ordered in the same way they are provided, but this still doesn&#039;t solve the multiple keys problem. MacRuby has a modified copy of the Ruby parser that is now able to reconstruct the complete selector (internally it doesn&#039;t use a Hash anymore but a list of key/pair elements. It still sends a Hash if the receiver doesn&#039;t respond to the selector, to preserve compatibility.

We can&#039;t re-implement the entire Ruby semantics with the Objective-C runtime. For example, it doesn&#039;t support instance variables to be added at runtime into a class, or classes to be nested. So, Ruby classes in MacRuby are not 100% Objective-C classes, because we still allocate some extra data structure to store the Ruby bits. But, Ruby objects are Objective-C objects, and Ruby methods are available in the Objective-C runtime.

Regarding the marshaling overhead, a MacRuby message will be of course slower than sending the same message in straight Objective-C. But as Jens says, since we don&#039;t have to convert the arguments and the return value, it&#039;s much more faster than a bridging solution. I also plan to unify the Ruby exception model with the same one as Objective-C, which has a costless &quot;try&quot; operation on 64-bit.

Will it be fast? I think it should be fast enough :)</description>
		<content:encoded><![CDATA[<blockquote><p>
If Ruby converts such arguments into a hash, both of those attributes would be lost.
</p></blockquote>
<p>Definitely, and this is why RubyCocoa wasn&#8217;t able to use this syntax for Objective-C selector messaging. In 1.9, hash keys are ordered in the same way they are provided, but this still doesn&#8217;t solve the multiple keys problem. MacRuby has a modified copy of the Ruby parser that is now able to reconstruct the complete selector (internally it doesn&#8217;t use a Hash anymore but a list of key/pair elements. It still sends a Hash if the receiver doesn&#8217;t respond to the selector, to preserve compatibility.</p>
<p>We can&#8217;t re-implement the entire Ruby semantics with the Objective-C runtime. For example, it doesn&#8217;t support instance variables to be added at runtime into a class, or classes to be nested. So, Ruby classes in MacRuby are not 100% Objective-C classes, because we still allocate some extra data structure to store the Ruby bits. But, Ruby objects are Objective-C objects, and Ruby methods are available in the Objective-C runtime.</p>
<p>Regarding the marshaling overhead, a MacRuby message will be of course slower than sending the same message in straight Objective-C. But as Jens says, since we don&#8217;t have to convert the arguments and the return value, it&#8217;s much more faster than a bridging solution. I also plan to unify the Ruby exception model with the same one as Objective-C, which has a costless &#8220;try&#8221; operation on 64-bit.</p>
<p>Will it be fast? I think it should be fast enough :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jens Alfke</title>
		<link>http://jens.mooseyard.com/2008/03/macruby/comment-page-1/#comment-2341</link>
		<dc:creator>Jens Alfke</dc:creator>
		<pubDate>Sun, 02 Mar 2008 20:45:38 +0000</pubDate>
		<guid isPermaLink="false">http://mooseyard.com/Jens/2008/03/macruby/#comment-2341</guid>
		<description>You&#039;re right that there will still be some marshaling going on, but objects are the most expensive things to marshal, due to the need to proxy or copy, so this will definitely help.

I&#039;m sure metaclasses will be tricky. But the Obj-C runtime gives you a fair amount of control over method resolution, so I suspect it&#039;ll be possible somehow. It sounds as though they want to do a faithful implementation of Ruby, not something just Ruby-like.</description>
		<content:encoded><![CDATA[<p>You&#8217;re right that there will still be some marshaling going on, but objects are the most expensive things to marshal, due to the need to proxy or copy, so this will definitely help.</p>
<p>I&#8217;m sure metaclasses will be tricky. But the Obj-C runtime gives you a fair amount of control over method resolution, so I suspect it&#8217;ll be possible somehow. It sounds as though they want to do a faithful implementation of Ruby, not something just Ruby-like.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Ryland</title>
		<link>http://jens.mooseyard.com/2008/03/macruby/comment-page-1/#comment-2340</link>
		<dc:creator>Chris Ryland</dc:creator>
		<pubDate>Sun, 02 Mar 2008 19:53:52 +0000</pubDate>
		<guid isPermaLink="false">http://mooseyard.com/Jens/2008/03/macruby/#comment-2340</guid>
		<description>Also, I don&#039;t see how you can base a Ruby (or Python or any other language) implementation on the Obj-C runtime, and remain true to the original language semantics at the lower levels (e.g., metaclasses, etc.). The result will be neither fish nor fowl, though it still might be useful, if it&#039;s Ruby-like.</description>
		<content:encoded><![CDATA[<p>Also, I don&#8217;t see how you can base a Ruby (or Python or any other language) implementation on the Obj-C runtime, and remain true to the original language semantics at the lower levels (e.g., metaclasses, etc.). The result will be neither fish nor fowl, though it still might be useful, if it&#8217;s Ruby-like.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Ryland</title>
		<link>http://jens.mooseyard.com/2008/03/macruby/comment-page-1/#comment-2339</link>
		<dc:creator>Chris Ryland</dc:creator>
		<pubDate>Sun, 02 Mar 2008 19:51:30 +0000</pubDate>
		<guid isPermaLink="false">http://mooseyard.com/Jens/2008/03/macruby/#comment-2339</guid>
		<description>Jens--

It&#039;s a small point, but even using the Obj-C runtime completely in all other respects can&#039;t eliminate marshalling overhead, unless you&#039;re also generating machine code in the same way the gcc/clang compilers are doing, and then you&#039;re not in the interpreted (Ruby VM) world any more.

I&#039;m thinking about this, as I&#039;m working on a similar project, and I don&#039;t see any way around this (short of Obj-C-style code generation).</description>
		<content:encoded><![CDATA[<p>Jens&#8212;</p>
<p>It&#8217;s a small point, but even using the Obj-C runtime completely in all other respects can&#8217;t eliminate marshalling overhead, unless you&#8217;re also generating machine code in the same way the gcc/clang compilers are doing, and then you&#8217;re not in the interpreted (Ruby VM) world any more.</p>
<p>I&#8217;m thinking about this, as I&#8217;m working on a similar project, and I don&#8217;t see any way around this (short of Obj-C-style code generation).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jens Alfke</title>
		<link>http://jens.mooseyard.com/2008/03/macruby/comment-page-1/#comment-2338</link>
		<dc:creator>Jens Alfke</dc:creator>
		<pubDate>Sun, 02 Mar 2008 03:50:41 +0000</pubDate>
		<guid isPermaLink="false">http://mooseyard.com/Jens/2008/03/macruby/#comment-2338</guid>
		<description>Chris — it&#039;s not quite the same, semantically. In Obj-C selectors the order of keywords is significant (-this:that: is not the same as -that:this:) and a keyword can be repeated (-performSelector:withObject:withObject:). If Ruby converts such arguments into a hash, both of those attributes would be lost.</description>
		<content:encoded><![CDATA[<p>Chris — it&#8217;s not quite the same, semantically. In Obj-C selectors the order of keywords is significant (-this:that: is not the same as -that:this:) and a keyword can be repeated (-performSelector:withObject:withObject:). If Ruby converts such arguments into a hash, both of those attributes would be lost.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://jens.mooseyard.com/2008/03/macruby/comment-page-1/#comment-2337</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Sun, 02 Mar 2008 01:35:34 +0000</pubDate>
		<guid isPermaLink="false">http://mooseyard.com/Jens/2008/03/macruby/#comment-2337</guid>
		<description>In other words, it&#039;s a handy bit of Ruby&#039;s famous syntactic sugar: trailing method call arguments in hash definition format are combined into a hash and passed as such to the method. Ruby 1.9 adds {key: value} as acceptable hash definition syntax.</description>
		<content:encoded><![CDATA[<p>In other words, it&#8217;s a handy bit of Ruby&#8217;s famous syntactic sugar: trailing method call arguments in hash definition format are combined into a hash and passed as such to the method. Ruby 1.9 adds {key: value} as acceptable hash definition syntax.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://jens.mooseyard.com/2008/03/macruby/comment-page-1/#comment-2336</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Sun, 02 Mar 2008 01:31:09 +0000</pubDate>
		<guid isPermaLink="false">http://mooseyard.com/Jens/2008/03/macruby/#comment-2336</guid>
		<description>&lt;blockquote&gt;Another nice feature of MacRuby is that it slightly extends Ruby’s method-call syntax to allow Objective-C style interleaved keywords and arguments.&lt;/blockquote&gt;

Actually, it does not. That syntax is already available in plain Ruby. The &#039;alternative&#039; syntax is available in Ruby 1.8, while Ruby 1.9 supports the more Objective-C like syntax. Do this in plain-jane irb with Tiger or Leopard (hope this gets formatted properly):

&lt;code&gt;
?&gt; def thing(one, two)
&gt;&gt; puts one
&gt;&gt; puts two.inspect
&gt;&gt; end
=&gt; nil
&gt;&gt; thing(&#039;equation&#039;, &#039;hot&#039; =&gt; &#039;cold&#039;, &#039;love&#039; =&gt; &#039;hate&#039;)
equation
{&quot;love&quot;=&gt;&quot;hate&quot;, &quot;hot&quot;=&gt;&quot;cold&quot;}
=&gt; nil
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<blockquote><p>Another nice feature of MacRuby is that it slightly extends Ruby’s method-call syntax to allow Objective-C style interleaved keywords and arguments.</p></blockquote>
<p>Actually, it does not. That syntax is already available in plain Ruby. The &#8216;alternative&#8217; syntax is available in Ruby 1.8, while Ruby 1.9 supports the more Objective-C like syntax. Do this in plain-jane irb with Tiger or Leopard (hope this gets formatted properly):</p>
<p><code><br />
?&#38;gt; def thing(one, two)<br />
&#38;gt;&#38;gt; puts one<br />
&#38;gt;&#38;gt; puts two.inspect<br />
&#38;gt;&#38;gt; end<br />
=&#38;gt; nil<br />
&#38;gt;&#38;gt; thing('equation', 'hot' =&#38;gt; 'cold', 'love' =&#38;gt; 'hate')<br />
equation<br />
{"love"=&#38;gt;"hate", "hot"=&#38;gt;"cold"}<br />
=&#38;gt; nil<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Tsai - Blog - MacRuby</title>
		<link>http://jens.mooseyard.com/2008/03/macruby/comment-page-1/#comment-2335</link>
		<dc:creator>Michael Tsai - Blog - MacRuby</dc:creator>
		<pubDate>Sat, 01 Mar 2008 20:28:53 +0000</pubDate>
		<guid isPermaLink="false">http://mooseyard.com/Jens/2008/03/macruby/#comment-2335</guid>
		<description>[...] MacRuby sounds very cool (via Jens Alfke): In MacRuby, all Ruby classes and objects are actually Objective-C classes and objects. There is no need to create costly proxies, convert objects and cache instances. A Ruby object can be toll-free casted at the C level as an Objective-C object, and the Ruby VM can also handle Objective-C objects without conversion. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] MacRuby sounds very cool (via Jens Alfke): In MacRuby, all Ruby classes and objects are actually Objective-C classes and objects. There is no need to create costly proxies, convert objects and cache instances. A Ruby object can be toll-free casted at the C level as an Objective-C object, and the Ruby VM can also handle Objective-C objects without conversion. [&#8230;]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->