From: Daniel Berger Date: 2008-09-28T10:05:38+09:00 Subject: Re: Help, Ruby 1.8.6-p287 broke my "use" library and I don't know why David A. Black wrote: > Hi -- > > On Sun, 28 Sep 2008, Daniel Berger wrote: > >> On Sep 27, 3:14?pm, "David A. Black" wrote: >>> Hi Dan -- >>> >>> On Sun, 28 Sep 2008, Daniel Berger wrote: >>>> Hi everyone, >>> >>>> I need help! >>> >>>> I've got a library called "use" that let's you mixin methods from >>>> modules in >>>> a fine-grained fashion. Unfortunately, something broke it between Ruby >>>> 1.8.6-p111 and Ruby 1.8.6-p287. >>> >>>> It may have something to do with the way I autogenerate some methods >>>> in the >>>> windows-api library, as simple cases still work fine, but I'm not >>>> sure how or >>>> why. >>> >>> Do you have a non-Windows example where it does this? >> >> Nobu's example summarizes the problem: >> >> require 'use' >> >> module X >> XXX = 1 >> def xxx >> XXX >> end >> end >> >> class Foo >> use X >> end >> >> Foo.new.xxx > > For what it's worth, here's an even simpler example, not involving > your "use" library: > > class Class > def myuse(mod) > include mod.clone > end > end > > module X > XXX = 1 > def xxx > XXX > end > end > > class Foo > myuse X > end > > Foo.new.xxx > > This works with p230 but not p287. I guess it has to do with module > cloning and constants, but I haven't tracked it down beyond that. Thanks for that David. I was wondering what the underlying issue was. Regards, Dan