--14dae934109f9af59904ceee386c
Content-Type: text/plain; charset=UTF-8

> This should return nil.  Otherwise, refinements can break code which
doesn't expect the refined behavior.

Ok. Makes sense.

> I don't understand why it's worse.

Only worse in that case if you had not said `nil`.

Since you did say `nil`, then what about:

    class S
      def foo
        "foo"
      end
      def bar
        "bar"
      end
      def foobar
        foo + bar
      end
    end

    module R
      refine S do
        def bar
          "bar!"
        end
      end
    end

    class C < S
      using R
      alias :foobar! :foobar
      def foobar?
        foo + bar
      end
      def brainfart1
        c  .new
        c.foobar! c.foobar?
      end
      def brainfart2
        c  .new
        s  .new
        c.foobar! s.foobar
      end
      def brainfart3
        c  .new
        s  .new
        c.bar s.bar
      end

    end

    C.new.brainfart1  #?
    C.new.brainfart2  #?
    C.new.brainfart3  #?

--14dae934109f9af59904ceee386c
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<span style="font-family:arial,sans-serif;font-size:13px">&gt; This should return nil. Otherwise, refinements can break code which doesn&#39;txpect the refined behavior.</span><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Ok. Makes sense.</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span><span style="font-family:arial,sans-serif;font-size:13px">&gt; I don&#39;t understand why it&#39;s worse.</span><div>
<font face="arial, sans-serif"><br></font></div><div><font face="arial,ans-serif">Only worse in that case if you had not said `nil`.</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">Since you did say `nil`, then what about:</font></div>
<div><div><br></div><div><div>  class S</div><div> C2def foo</div><div>    &quot;foo&quot;   </div><div>   end</div><div><div>   def bar</div><div>    &quot;bar&quot;C2 </div><div>   end</div></div>
<div>   def foobar</div><div>    foo + bar</div><div>   end</div><div>  end<br></div></div><div><br></div><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">  module R</span><br style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">
<span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">   refine S do</span><br style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px"><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">    def bar</span><br style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">
<span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">     &quot;bar!&quot;</span><br style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px"><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">    end</span><br style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">
<span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">   end</span><br style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px"><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">  end</span><br>
</div><div><br></div><div><div>  class C &lt; S</div><div>   using R</div><div>   alias :foobar! :foobar<br></div><div>   def foobar?<br></div><div>    foo + bar</div><div>   end</div><div>   def brainfart1<br>
</div><div><div>    c = C.new</div><div>    c.foobar! == c.foobar?<br></div><div> C2end</div></div><div><div>   def brainfart2<br></div><div>    c = C.new</div><div>    s = S.new</div><div>    c.foobar! == s.foobar</div>
<div>   end</div></div><div><div>   defrainfart3<br></div><div>    c = C.new</div><div>    s = S.new</div><div>    c.bar == s.bar</div><div>   end</div></div><div><br></div><div>  end<br></div></div>
<div><br></div><div>  C.new.brainfart1 #=&gt; ?</div><div>  C.new.brainfart2 #=&gt; ?<br></div><div>  C.new.brainfart3 #=&gt; ?<br></div><div><br></div></div></div><div class="gmail_extra"><br><br>
</div>

--14dae934109f9af59904ceee386c--