<?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: Twitter and Ruby&#8217;s Open Classes</title>
	<atom:link href="http://push.cx/2009/twitter-and-rubys-open-classes/feed" rel="self" type="application/rss+xml" />
	<link>http://push.cx/2009/twitter-and-rubys-open-classes</link>
	<description>A traveling geek&#039;s blog on development, games, and the web</description>
	<lastBuildDate>Tue, 17 Jan 2012 16:49:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Scoped mixins &#124; self.collect(&#38;:code)</title>
		<link>http://push.cx/2009/twitter-and-rubys-open-classes/comment-page-1#comment-89867</link>
		<dc:creator>Scoped mixins &#124; self.collect(&#38;:code)</dc:creator>
		<pubDate>Wed, 21 Jan 2009 23:58:37 +0000</pubDate>
		<guid isPermaLink="false">http://push.cx/?p=416#comment-89867</guid>
		<description>[...] while ago I read one of Peter Harkins&#8217;s posts about open classes in Ruby, and how insanely awesome and useful they are. As you can probably tell, [...]</description>
		<content:encoded><![CDATA[<p>[...] while ago I read one of Peter Harkins&#8217;s posts about open classes in Ruby, and how insanely awesome and useful they are. As you can probably tell, [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Harkins</title>
		<link>http://push.cx/2009/twitter-and-rubys-open-classes/comment-page-1#comment-89730</link>
		<dc:creator>Peter Harkins</dc:creator>
		<pubDate>Fri, 16 Jan 2009 00:41:08 +0000</pubDate>
		<guid isPermaLink="false">http://push.cx/?p=416#comment-89730</guid>
		<description>That&#039;s all kinds of fun-looking.</description>
		<content:encoded><![CDATA[<p>That&#8217;s all kinds of fun-looking.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sander Dieleman</title>
		<link>http://push.cx/2009/twitter-and-rubys-open-classes/comment-page-1#comment-89727</link>
		<dc:creator>Sander Dieleman</dc:creator>
		<pubDate>Thu, 15 Jan 2009 23:46:09 +0000</pubDate>
		<guid isPermaLink="false">http://push.cx/?p=416#comment-89727</guid>
		<description>Whoa, scary. Looks like _why thought of this concept (local mixins) a few days before me, and decided to &lt;a href=&quot;http://github.com/why/potion/tree/master&quot; title=&quot;potion&quot; rel=&quot;nofollow&quot;&gt;act on it&lt;/a&gt; :)

I don&#039;t really see this ever making its way into Ruby, but it&#039;s a compelling idea, nevertheless :)</description>
		<content:encoded><![CDATA[<p>Whoa, scary. Looks like _why thought of this concept (local mixins) a few days before me, and decided to <a href="http://github.com/why/potion/tree/master" title="potion" rel="nofollow">act on it</a> :)</p>
<p>I don&#8217;t really see this ever making its way into Ruby, but it&#8217;s a compelling idea, nevertheless :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Harkins</title>
		<link>http://push.cx/2009/twitter-and-rubys-open-classes/comment-page-1#comment-89687</link>
		<dc:creator>Peter Harkins</dc:creator>
		<pubDate>Mon, 12 Jan 2009 20:53:58 +0000</pubDate>
		<guid isPermaLink="false">http://push.cx/?p=416#comment-89687</guid>
		<description>Sander: yeah, you&#039;re exactly right there. Guess I didn&#039;t clean up enough after extracting it. I&#039;m correcting the post.

Anyone curious, the posted original was:
&lt;code lang=&quot;ruby&quot;&gt;
class Range
  def rand
    Kernel.rand(GAP.last - GAP.first) + GAP.first
  end
end
&lt;/code&gt;

I haven&#039;t yet worked on a project large enough to shoot itself in the foot with mixins, partly because Ruby code tends to be short. But I guess I can imagine how it would happen, especially if you had bad coders.</description>
		<content:encoded><![CDATA[<p>Sander: yeah, you&#8217;re exactly right there. Guess I didn&#8217;t clean up enough after extracting it. I&#8217;m correcting the post.</p>
<p>Anyone curious, the posted original was:</p>
<pre>&nbsp;
class Range
  def <span style="color: #000066;">rand</span>
    Kernel.<span style="">rand</span><span style="color: #66cc66;">&#40;</span>GAP.<span style="">last</span> - GAP.<span style="">first</span><span style="color: #66cc66;">&#41;</span> + GAP.<span style="">first</span>
  <span style="color: #b1b100;">end</span>
end</pre>
<p>I haven&#8217;t yet worked on a project large enough to shoot itself in the foot with mixins, partly because Ruby code tends to be short. But I guess I can imagine how it would happen, especially if you had bad coders.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sander Dieleman</title>
		<link>http://push.cx/2009/twitter-and-rubys-open-classes/comment-page-1#comment-89686</link>
		<dc:creator>Sander Dieleman</dc:creator>
		<pubDate>Mon, 12 Jan 2009 19:11:36 +0000</pubDate>
		<guid isPermaLink="false">http://push.cx/?p=416#comment-89686</guid>
		<description>&lt;code&gt;Range#rand&lt;/code&gt; should use &lt;code&gt;self.first&lt;/code&gt; and &lt;code&gt;self.last&lt;/code&gt;, rather than &lt;code&gt;GAP.first&lt;/code&gt; and &lt;code&gt;GAP.last&lt;/code&gt;, if I&#039;m not mistaken ;)

I have adopted this practice too, to the extent that most of my personal projects have a file &lt;code&gt;extensions.rb&lt;/code&gt; that contains just this kind of convenience methods. Large parts of these files tend to migrate across projects as well. I should start thinking about keeping them somewhere centralised, perhaps.

It&#039;s a pity that this technique becomes somewhat unusable for larger projects or libraries, because in a way this isn&#039;t any better than global namespace pollution...
Something like &lt;em&gt;local mixins&lt;/em&gt; would be a pretty cool concept, but probably a bit too mind-bending for our own good :)</description>
		<content:encoded><![CDATA[<p><code>Range#rand</code> should use <code>self.first</code> and <code>self.last</code>, rather than <code>GAP.first</code> and <code>GAP.last</code>, if I&#8217;m not mistaken ;)</p>
<p>I have adopted this practice too, to the extent that most of my personal projects have a file <code>extensions.rb</code> that contains just this kind of convenience methods. Large parts of these files tend to migrate across projects as well. I should start thinking about keeping them somewhere centralised, perhaps.</p>
<p>It&#8217;s a pity that this technique becomes somewhat unusable for larger projects or libraries, because in a way this isn&#8217;t any better than global namespace pollution&#8230;<br />
Something like <em>local mixins</em> would be a pretty cool concept, but probably a bit too mind-bending for our own good :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Harkins</title>
		<link>http://push.cx/2009/twitter-and-rubys-open-classes/comment-page-1#comment-89684</link>
		<dc:creator>Peter Harkins</dc:creator>
		<pubDate>Mon, 12 Jan 2009 17:40:34 +0000</pubDate>
		<guid isPermaLink="false">http://push.cx/?p=416#comment-89684</guid>
		<description>Yeah, that&#039;s exactly what I did. I extracted sha1 when I realized I was repeating the call, it&#039;s what got me thinking of it. Then I extracted the rands and save_file when I thought they were a noisy distraction.</description>
		<content:encoded><![CDATA[<p>Yeah, that&#8217;s exactly what I did. I extracted sha1 when I realized I was repeating the call, it&#8217;s what got me thinking of it. Then I extracted the rands and save_file when I thought they were a noisy distraction.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lucas Sallovitz</title>
		<link>http://push.cx/2009/twitter-and-rubys-open-classes/comment-page-1#comment-89680</link>
		<dc:creator>Lucas Sallovitz</dc:creator>
		<pubDate>Mon, 12 Jan 2009 13:52:07 +0000</pubDate>
		<guid isPermaLink="false">http://push.cx/?p=416#comment-89680</guid>
		<description>I find that&#039;s a great coding style for small scrips, and a usefull practice even if you are doing something bigger, specially if you can develop de habit of writing de last part fisrt, in this case, from &quot;# load fortunes, loop to pick one randomly&quot; downwards.</description>
		<content:encoded><![CDATA[<p>I find that&#8217;s a great coding style for small scrips, and a usefull practice even if you are doing something bigger, specially if you can develop de habit of writing de last part fisrt, in this case, from &#8220;# load fortunes, loop to pick one randomly&#8221; downwards.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

