<?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 2.0 Refinements in Practice</title>
	<atom:link href="http://yehudakatz.com/2010/11/30/ruby-2-0-refinements-in-practice/feed/" rel="self" type="application/rss+xml" />
	<link>http://yehudakatz.com/2010/11/30/ruby-2-0-refinements-in-practice/</link>
	<description>Random Geek-Related Thoughts</description>
	<lastBuildDate>Sat, 20 Apr 2013 07:23:38 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Eric S.</title>
		<link>http://yehudakatz.com/2010/11/30/ruby-2-0-refinements-in-practice/comment-page-1/#comment-25759</link>
		<dc:creator>Eric S.</dc:creator>
		<pubDate>Fri, 07 Dec 2012 17:40:15 +0000</pubDate>
		<guid isPermaLink="false">http://yehudakatz.com/?p=577#comment-25759</guid>
		<description><![CDATA[This is a cool feature.  Objective-C has also long suffered from the monkey patching issue.  Hopefully it can be implemented efficiently.  I&#039;m also looking forward to named arguments.  That will make MacRuby and RubyMotion feel more natural.

Long term, I hope Ruby finds some ways to increase performance for lower level programming.  I&#039;d like to use Ruby for everything.  It is getting faster, but still not ideal for some types of algorithms.  I would also love to see compile time (or load time when interpreted) eval expressions as another option when implementing DSLs.  That could improve performance significantly for many DSLs.  

My pipe dream is to see Ruby become more of a multi-paradigm language.  Smalltalk style programming should always be the core, but adding let expressions (and guards) would be cool.  I could envision them defined in classes, modules, and methods.  Those expressions could have a Haskell-style static type system.   Static typing at the expression level would not interfere with standard duck typing.  A Haskell-style type system for expressions could improve performance and abstraction at the expression level.  For performance reasons, there would probably need to be limitations on re-definition.  I think it would be the best of both worlds.  Kind of like OCaml in reverse.]]></description>
		<content:encoded><![CDATA[<p>This is a cool feature.  Objective-C has also long suffered from the monkey patching issue.  Hopefully it can be implemented efficiently.  I&#8217;m also looking forward to named arguments.  That will make MacRuby and RubyMotion feel more natural.</p>
<p>Long term, I hope Ruby finds some ways to increase performance for lower level programming.  I&#8217;d like to use Ruby for everything.  It is getting faster, but still not ideal for some types of algorithms.  I would also love to see compile time (or load time when interpreted) eval expressions as another option when implementing DSLs.  That could improve performance significantly for many DSLs.  </p>
<p>My pipe dream is to see Ruby become more of a multi-paradigm language.  Smalltalk style programming should always be the core, but adding let expressions (and guards) would be cool.  I could envision them defined in classes, modules, and methods.  Those expressions could have a Haskell-style static type system.   Static typing at the expression level would not interfere with standard duck typing.  A Haskell-style type system for expressions could improve performance and abstraction at the expression level.  For performance reasons, there would probably need to be limitations on re-definition.  I think it would be the best of both worlds.  Kind of like OCaml in reverse.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Waldrip</title>
		<link>http://yehudakatz.com/2010/11/30/ruby-2-0-refinements-in-practice/comment-page-1/#comment-25758</link>
		<dc:creator>Jason Waldrip</dc:creator>
		<pubDate>Thu, 06 Dec 2012 07:46:17 +0000</pubDate>
		<guid isPermaLink="false">http://yehudakatz.com/?p=577#comment-25758</guid>
		<description><![CDATA[I would love to see refine work on singleton classes as far as I can tell right now they do not.

class FooController &lt; ApplicationController

  before_filter do
    singleton_class.class_eval %{
      refine Foo do

        def bar
          &quot;beer&quot;
        end

      end
    }
  end

  def index
    render text: Foo.new.bar # returns &quot;baz&quot;, but should return &quot;beer&quot;
  end

end]]></description>
		<content:encoded><![CDATA[<p>I would love to see refine work on singleton classes as far as I can tell right now they do not.</p>
<p>class FooController &lt; ApplicationController</p>
<p>  before_filter do<br />
    singleton_class.class_eval %{<br />
      refine Foo do</p>
<p>        def bar<br />
          &quot;beer&quot;<br />
        end</p>
<p>      end<br />
    }<br />
  end</p>
<p>  def index<br />
    render text: Foo.new.bar # returns &quot;baz&quot;, but should return &quot;beer&quot;<br />
  end</p>
<p>end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RipTheJacker</title>
		<link>http://yehudakatz.com/2010/11/30/ruby-2-0-refinements-in-practice/comment-page-1/#comment-21819</link>
		<dc:creator>RipTheJacker</dc:creator>
		<pubDate>Mon, 06 Dec 2010 23:05:40 +0000</pubDate>
		<guid isPermaLink="false">http://yehudakatz.com/?p=577#comment-21819</guid>
		<description><![CDATA[I like the article and discussion, but it may be misleading since it is redefining what ActiveSupport really is.

&quot;A toolkit of support libraries and Ruby core extensions extracted from the Rails framework.&quot;

Having to &quot;use&quot; a bunch of AS modules in everything would be really annoying, and introduce a lot of duplication in code (and maybe slow things down). Liking or disliking that idea is outside of the scope of this (probably). 

But for the proposed changes to ruby core by adding &quot;refinements&quot;, I like that idea.  I find the syntax strange, since what you are doing isn&#039;t really &quot;refining&quot; a class, it&#039;s like extending it in most cases. I really don&#039;t care too much about what it&#039;s called, just a thought. I like the #used callback and the #using syntax since it will clearly show that a module is being added that changes other classes.]]></description>
		<content:encoded><![CDATA[<p>I like the article and discussion, but it may be misleading since it is redefining what ActiveSupport really is.</p>
<p>&#8220;A toolkit of support libraries and Ruby core extensions extracted from the Rails framework.&#8221;</p>
<p>Having to &#8220;use&#8221; a bunch of AS modules in everything would be really annoying, and introduce a lot of duplication in code (and maybe slow things down). Liking or disliking that idea is outside of the scope of this (probably). </p>
<p>But for the proposed changes to ruby core by adding &#8220;refinements&#8221;, I like that idea.  I find the syntax strange, since what you are doing isn&#8217;t really &#8220;refining&#8221; a class, it&#8217;s like extending it in most cases. I really don&#8217;t care too much about what it&#8217;s called, just a thought. I like the #used callback and the #using syntax since it will clearly show that a module is being added that changes other classes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Papile</title>
		<link>http://yehudakatz.com/2010/11/30/ruby-2-0-refinements-in-practice/comment-page-1/#comment-21781</link>
		<dc:creator>Michael Papile</dc:creator>
		<pubDate>Fri, 03 Dec 2010 19:07:00 +0000</pubDate>
		<guid isPermaLink="false">http://yehudakatz.com/?p=577#comment-21781</guid>
		<description><![CDATA[@James Healy I think it is more of that people expect a certain behavior when they run activesupport and as you see Right::AWS was expecting that the person would probably be running activesupport and they would have that method available.  If it did not detect that, it opened String to put camelize in for its own usage (and now globally add it to String) which is not what someone running this gem would expect.  When people run activesupport they expect the class to be opened and methods to be added.  

If Right::AWS depended on camelize for its own usage it should either depend on activesupport or implement it itself in a util module. (as it was looking for activesupport)  I personally think activesupport should not have a monopoly on opening classes for itself either.  When I use activesupport I am very careful to require only what I need because I do not like how it opens a lot of classes.]]></description>
		<content:encoded><![CDATA[<p>@James Healy I think it is more of that people expect a certain behavior when they run activesupport and as you see Right::AWS was expecting that the person would probably be running activesupport and they would have that method available.  If it did not detect that, it opened String to put camelize in for its own usage (and now globally add it to String) which is not what someone running this gem would expect.  When people run activesupport they expect the class to be opened and methods to be added.  </p>
<p>If Right::AWS depended on camelize for its own usage it should either depend on activesupport or implement it itself in a util module. (as it was looking for activesupport)  I personally think activesupport should not have a monopoly on opening classes for itself either.  When I use activesupport I am very careful to require only what I need because I do not like how it opens a lot of classes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jedediah Smith</title>
		<link>http://yehudakatz.com/2010/11/30/ruby-2-0-refinements-in-practice/comment-page-1/#comment-21754</link>
		<dc:creator>Jedediah Smith</dc:creator>
		<pubDate>Tue, 30 Nov 2010 15:19:46 +0000</pubDate>
		<guid isPermaLink="false">http://yehudakatz.com/?p=577#comment-21754</guid>
		<description><![CDATA[&quot;It’s important to note that the refinement only applies to methods physically inside the same block.&quot;

Actually no, it applies to all methods of the class or its subclasses that are defined after the &quot;using&quot; is evaluated, which may be at least partly a bug.

I suspect that when the dust settles, it will end up working like you described. Anything else is too chaotic.]]></description>
		<content:encoded><![CDATA[<p>&#8220;It’s important to note that the refinement only applies to methods physically inside the same block.&#8221;</p>
<p>Actually no, it applies to all methods of the class or its subclasses that are defined after the &#8220;using&#8221; is evaluated, which may be at least partly a bug.</p>
<p>I suspect that when the dust settles, it will end up working like you described. Anything else is too chaotic.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Oliver Nutter</title>
		<link>http://yehudakatz.com/2010/11/30/ruby-2-0-refinements-in-practice/comment-page-1/#comment-21753</link>
		<dc:creator>Charles Oliver Nutter</dc:creator>
		<pubDate>Tue, 30 Nov 2010 10:53:46 +0000</pubDate>
		<guid isPermaLink="false">http://yehudakatz.com/?p=577#comment-21753</guid>
		<description><![CDATA[I posted my concerns about refinements to the ruby-core list:

http://groups.google.com/group/ruby-core-google/msg/7ccc375905dda23c

In short, I think they need to be trully lexically scoped, or there will be intractable performance and/or concurrency issues that result. It should not be possible for a given scope to become &quot;refined&quot; long after it has been parsed, as in the instance_eval cases.]]></description>
		<content:encoded><![CDATA[<p>I posted my concerns about refinements to the ruby-core list:</p>
<p><a href="http://groups.google.com/group/ruby-core-google/msg/7ccc375905dda23c" rel="nofollow">http://groups.google.com/group/ruby-core-google/msg/7ccc375905dda23c</a></p>
<p>In short, I think they need to be trully lexically scoped, or there will be intractable performance and/or concurrency issues that result. It should not be possible for a given scope to become &#8220;refined&#8221; long after it has been parsed, as in the instance_eval cases.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: josh susser</title>
		<link>http://yehudakatz.com/2010/11/30/ruby-2-0-refinements-in-practice/comment-page-1/#comment-21752</link>
		<dc:creator>josh susser</dc:creator>
		<pubDate>Tue, 30 Nov 2010 09:10:04 +0000</pubDate>
		<guid isPermaLink="false">http://yehudakatz.com/?p=577#comment-21752</guid>
		<description><![CDATA[OK, I believe in the use case now.  I think the syntax would make more sense if #using took a block (`using Foo do ... end` and the contents of the block were what got refined (is that the right way to say it?).  Or if it were a keyword construct like `if` and the scope would be like `using Foo ... end`.  I&#039;m thinking more about implementation than syntactic sugar, so I&#039;ll defer to Charlie and Evan.

It seems like this will solve one of the uglier things in Rails - the leakage of internal AssociationProxy methods that makes them visible outside the proxy. charity.campaign.target should be the target attribute of the campaign, not the associated model of the campaign association proxy.]]></description>
		<content:encoded><![CDATA[<p>OK, I believe in the use case now.  I think the syntax would make more sense if #using took a block (`using Foo do &#8230; end` and the contents of the block were what got refined (is that the right way to say it?).  Or if it were a keyword construct like `if` and the scope would be like `using Foo &#8230; end`.  I&#8217;m thinking more about implementation than syntactic sugar, so I&#8217;ll defer to Charlie and Evan.</p>
<p>It seems like this will solve one of the uglier things in Rails &#8211; the leakage of internal AssociationProxy methods that makes them visible outside the proxy. charity.campaign.target should be the target attribute of the campaign, not the associated model of the campaign association proxy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wycats</title>
		<link>http://yehudakatz.com/2010/11/30/ruby-2-0-refinements-in-practice/comment-page-1/#comment-21751</link>
		<dc:creator>wycats</dc:creator>
		<pubDate>Tue, 30 Nov 2010 08:56:41 +0000</pubDate>
		<guid isPermaLink="false">http://yehudakatz.com/?p=577#comment-21751</guid>
		<description><![CDATA[In my mind, in Ruby &lt; 2.0, there&#039;s a category of library which is &quot;provide a number of useful core extensions.&quot; The three major ones are ActiveSupport, Extlib and Facets. In general, applications need to choose one, but not more of these libraries to avoid conflicts. These libraries are designed to be used in applications, and things get a bit murky when they are used as dependencies of other standalone libraries. For instance, using DataMapper with Rails was a problem for a while because of conflicts between Extlib and ActiveSupport. They eventually removed the dependency on Extlib, but it definitely illustrates the larger systemic issue that refinements are trying to solve.

On the other hand, Right::AWS is not a library that provides core extensions, nor does it depend on such a library (if it did, it would end up in the same place as DataMapper and ActiveMerchant, which is an unsatisfying but somewhat more grey area). Since it only creates the helpers for its own use, it should use utility methods to avoid the problem described in this post.]]></description>
		<content:encoded><![CDATA[<p>In my mind, in Ruby &lt; 2.0, there&#039;s a category of library which is &quot;provide a number of useful core extensions.&quot; The three major ones are ActiveSupport, Extlib and Facets. In general, applications need to choose one, but not more of these libraries to avoid conflicts. These libraries are designed to be used in applications, and things get a bit murky when they are used as dependencies of other standalone libraries. For instance, using DataMapper with Rails was a problem for a while because of conflicts between Extlib and ActiveSupport. They eventually removed the dependency on Extlib, but it definitely illustrates the larger systemic issue that refinements are trying to solve.</p>
<p>On the other hand, Right::AWS is not a library that provides core extensions, nor does it depend on such a library (if it did, it would end up in the same place as DataMapper and ActiveMerchant, which is an unsatisfying but somewhat more grey area). Since it only creates the helpers for its own use, it should use utility methods to avoid the problem described in this post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Olaf</title>
		<link>http://yehudakatz.com/2010/11/30/ruby-2-0-refinements-in-practice/comment-page-1/#comment-21750</link>
		<dc:creator>Olaf</dc:creator>
		<pubDate>Tue, 30 Nov 2010 08:52:32 +0000</pubDate>
		<guid isPermaLink="false">http://yehudakatz.com/?p=577#comment-21750</guid>
		<description><![CDATA[Excellent idea! This will be very useful. Reminds me of Scala&#039;s implicits, except that instead of using &quot;using&quot;, one would simply import the module that defined the refinement.]]></description>
		<content:encoded><![CDATA[<p>Excellent idea! This will be very useful. Reminds me of Scala&#8217;s implicits, except that instead of using &#8220;using&#8221;, one would simply import the module that defined the refinement.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Healy</title>
		<link>http://yehudakatz.com/2010/11/30/ruby-2-0-refinements-in-practice/comment-page-1/#comment-21749</link>
		<dc:creator>James Healy</dc:creator>
		<pubDate>Tue, 30 Nov 2010 08:47:16 +0000</pubDate>
		<guid isPermaLink="false">http://yehudakatz.com/?p=577#comment-21749</guid>
		<description><![CDATA[I agree the refinements patch looks interesting, but this comment caught my eye:

&quot;In general, Right::AWS should have done something like Right::Utils.camelize  in their code to avoid this problem.&quot;

Why was the onus on Right::AWS to use Right::Utils.camelize and not on ActiveSupport to do something similar?]]></description>
		<content:encoded><![CDATA[<p>I agree the refinements patch looks interesting, but this comment caught my eye:</p>
<p>&#8220;In general, Right::AWS should have done something like Right::Utils.camelize  in their code to avoid this problem.&#8221;</p>
<p>Why was the onus on Right::AWS to use Right::Utils.camelize and not on ActiveSupport to do something similar?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
