--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'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"><matz / ruby-lang.org></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 "Re: [ruby-core:21399] Proposal: Module#copy_method"<br> <div class="Ih2E3d"> on Sun, 18 Jan 2009 16:26:19 +0900, Yehuda Katz <wycats / gmail.com> writes:<br> <br> |I'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'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. Try<br> <br> class Foo<br> copy_method Bignum, :odd?<br> end<br> Foo.new.odd?<br> <br> for example. The issue is more difficult than it seems. I've had<br> similar issue when we implemented Method#bind, this one is even<br> tougher.<br> <br> 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--