--0015174bdfec3340220460d23b5e
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Matz,
Couldn't we just filter out all c-funcs from copying?

-- Yehuda

On Mon, Jan 19, 2009 at 1:10 AM, Yukihiro Matsumoto <matz / ruby-lang.org>wrote:

> Hi,
>
> In message "Re: [ruby-core:21399] Proposal: Module#copy_method"
>     on Sun, 18 Jan 2009 16:26:19 +0900, Yehuda Katz <wycats / gmail.com>
> writes:
>
> |I'd like it to be possible to copy methods from one module to another. The
> |rationale is that this feature would make it possible to modify existing
> |methods without being forced to resort to aliasing. Here's an
> implementation
> |that works on 1.8 and 1.9:
>
> This implementation can easily cause segmentation fault, since many C
> implemented method does not check type of their receivers.  Try
>
>  class Foo
>    copy_method Bignum, :odd?
>  end
>  Foo.new.odd?
>
> for example.  The issue is more difficult than it seems.  I've had
> similar issue when we implemented Method#bind, this one is even
> tougher.
>
>                                                        matz.
>
>


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

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

Matz,<div><br></div><div>Couldn&#39;t we just filter out all c-funcs from copying?</div><div><br></div><div>-- Yehuda<br><br><div class="gmail_quote">On Mon, Jan 19, 2009 at 1:10 AM, Yukihiro Matsumoto <span dir="ltr">&lt;matz / ruby-lang.org&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<br>
In message &quot;Re: [ruby-core:21399] Proposal: Module#copy_method&quot;<br>
<div class="Ih2E3d"> &nbsp; &nbsp;on Sun, 18 Jan 2009 16:26:19 +0900, Yehuda Katz &lt;wycats / gmail.com&gt; writes:<br>
<br>
|I&#39;d like it to be possible to copy methods from one module to another.he<br>
|rationale is that this feature would make it possible to modify existing<br>
|methods without being forced to resort to aliasing. Here&#39;s an implementation<br>
|that works on 1.8 and 1.9:<br>
<br>
</div>This implementation can easily cause segmentation fault, since many C<br>
implemented method does not check type of their receivers. &nbsp;Try<br>
<br>
 &nbsp;class Foo<br>
 &nbsp; &nbsp;copy_method Bignum, :odd?<br>
 &nbsp;end<br>
 &nbsp;Foo.new.odd?<br>
<br>
for example. &nbsp;The issue is more difficult than it seems. &nbsp;I&#39;ve had<br>
similar issue when we implemented Method#bind, this one is even<br>
tougher.<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;matz.<br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>Yehuda Katz<br>Developer | Engine Yard<br>(ph) 718.877.1325<br>
</div>

--0015174bdfec3340220460d23b5e--