--00c09f8de53148d1880472902166
Content-Type: text/plain; charset=ISO-8859-1

On Tue, Sep 1, 2009 at 5:37 PM, David A. Black <dblack / rubypal.com> wrote:

> Hi --
>
>
> On Tue, 1 Sep 2009, Yehuda Katz wrote:
>
>
>>
>> On Mon, Aug 31, 2009 at 4:09 AM, David A. Black <dblack / rubypal.com>
>> wrote:
>>      Hi --
>>
>>      On Mon, 31 Aug 2009, Yehuda Katz wrote:
>>
>>
>>
>>            On Sun, Aug 30, 2009 at 10:09 PM, Joel VanderWerf
>>            <vjoel / path.berkeley.edu>
>>            wrote:
>>                 Yehuda Katz wrote:
>>                       class Person
>>                        prepend Exclaimer
>>                       end
>>
>>
>>            Is there some way to make the relationship more
>>            visually obvious?
>>
>>            class Person > Exclaimer
>>            end
>>
>>            class Person
>>             self >> Exclaimer
>>            end
>>
>>
>>            Hmmm... seems potentially a bit visually confusing.
>>            I'm happy with prepend,
>>            in particular if we also make prepend a method on
>>            Array.
>>
>>
>> I like the idea of the reverse #include but I'm not sure about the
>> name. The problem, for me, is that it's *too* array-like. The other
>> related operations don't have that same spatial/collection feel to
>> them. Somehow prepend doesn't sound like it's in the same semantic
>> space as include.
>>
>> Now I'm supposed to pony up a brilliant alternative :-) include! came
>> to mind. The "dangerous" aspect is that it occludes the current
>> version of the method.
>>
>>  module M
>>    def x
>>    end
>>  end
>>
>>  class C
>>    def x
>>    end
>>
>>    include M       # doesn't affect instances
>>    include! M      # blocks this class's same-named methods
>>  end
>>
>> Mind you, I've always been intrigued by the idea of ancestors being
>> a fully read-write array. But the current semantics of include are not
>> very array-like, so I'm not sure about "prepend".
>>
>>
>> We asked Matz about that, and he felt it was a bit *too* much. One major
>> problem is that it would affect classes and not just modules, with more
>> dubious semantics.
>>
>
> True.
>
> One question about the prepend idea:
>
>  module M
>    def x; "M's x"; end
>  end
>
>  module N
>    def x; "N's x"; end
>    prepend M   # or whatever it's called :-)
>  end
>
>  class C
>    include N
>  end
>
> Would N have sacrificed itself, so to speak, to M, so that:
>
>  C.new.x
>
> would print "M's x"?


Yep. But keep in mind that M could call super, which would go to N's x.

-- Yehuda


>
>
>
> David
>
> --
> David A. Black / Ruby Power and Light, LLC / http://www.rubypal.com
> Ruby/Rails training, mentoring, consulting, code-review
> Latest book: The Well-Grounded Rubyist (http://www.manning.com/black2)
>
> September Ruby training in NJ has been POSTPONED. Details to follow.
>



-- 
Yehuda Katz
Developer | Engine Yard
(ph) 718.877.1325

--00c09f8de53148d1880472902166
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br><br><div class="gmail_quote">On Tue, Sep 1, 2009 at 5:37 PM, David A.lack <span dir="ltr">&lt;dblack / rubypal.com&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Hi --<div><div></div><div class="h5"><br>
<br>
On Tue, 1 Sep 2009, Yehuda Katz wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
On Mon, Aug 31, 2009 at 4:09 AM, David A. Black &lt;<a href="mailto:dblack / rubypal.com" target="_blank">dblack / rubypal.com</a>&gt; wrote:<br>
  ­
<br>
      庼
<br>
<br>
<br>
      
 lt;<a href="mailto:vjoel / path.berkeley.edu" target="_blank">vjoel / path.berkeley.edu</a>&gt;<br>
  庼      庼
      
      prepend Exclaimer<br>
     
<br>
<br>
      
  
<br>
       
<br>
   
   self &gt;&gt; Exclaimer<br>
  
<br>
<br>
      箼
  ¦  䬼
        
  <br>
<br>
I like the idea of the reverse #include but I&#39;m not sure about the<br>
name. The problem, for me, is that it&#39;s *too* array-like. The other<br>
related operations don&#39;t have that same spatial/collection feel to<br>
them. Somehow prepend doesn&#39;t sound like it&#39;s in the same semantic<br>
space as include.<br>
<br>
Now I&#39;m supposed to pony up a brilliant alternative :-) include! came<br>
to mind. The &quot;dangerous&quot; aspect is that it occludes the current<br>
version of the method.<br>
<br>
 ͼ   
 
<br>
  ü   
<br>
       󦣳  
<br>
Mind you, I&#39;ve always been intrigued by the idea of ancestors being<br>
a fully read-write array. But the current semantics of include are not<br>
very array-like, so I&#39;m not sure about &quot;prepend&quot;.<br>
<br>
<br>
We asked Matz about that, and he felt it was a bit *too* much. One major<br>
problem is that it would affect classes and not just modules, with more<br>
dubious semantics.<br>
</blockquote>
<br></div></div>
True.<br>
<br>
One question about the prepend idea:<br>
<br>
  ͼ    ͦ   
<br>
  μ    Φ          
<br>
   ü   μ  
<br>
Would N have sacrificed itself, so to speak, to M, so that:<br>
<br>
  ®
<br>
would print &quot;M&#39;s x&quot;?</blockquote><div><br></div><div>Yep. Buteep in mind that M could call super, which would go to N&#39;s x.</div><div><br></div><div>-- Yehuda</div><div>/div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div><div></div><div class="h5"><br>
<br>
<br>
David<br>
<br>
-- <br>
David A. Black / Ruby Power and Light, LLC / <a href="http://www.rubypal.com" target="_blank">http://www.rubypal.com</a><br>
Ruby/Rails training, mentoring, consulting, code-review<br>
Latest book: The Well-Grounded Rubyist (<a href="http://www.manning.com/black2" target="_blank">http://www.manning.com/black2</a>)<br>
<br>
September Ruby training in NJ has been POSTPONED. Details to follow.</div></div></blockquote></div><br><br clear="all"><br>-- <br>Yehuda Katz<br>Developer | Engine Yard<br>(ph) 718.877.1325<br>

--00c09f8de53148d1880472902166--