Ben Hall
2008-Oct-06 01:28 UTC
[Ironruby-core] Annoymous class extending a module doesn''t return expected kind_of
Hi guys, I''ve been bashing my head again this problem for the last few days where the object I expected wasn''t passed around, tonight I decided to break it down and focus on a much small part. Turns out, I was looking in the wrong part. This is what I think the problem is. The code is creating an anonymous class which is extending a module. The code then does a kind_of? to decide what to do with it.>From what I can tell, it looks like the kind_of doesn''t recognize themodules it is extending. This is the code which demonstrates the problem: Code Repro: module AAA class << self def a puts "Hello" end end def myAAA klass = Class.new do extend AAA end puts "Am I a type of what I extended (AAA)?" puts klass.kind_of?(AAA) end end class XYZ include AAA end $a = XYZ.new $a.myAAA With MRI, true is returned. With IronRuby, false is returned. Output: E:\IronRuby\trunk\build\debug>ruby array_test Am I a type of what I extended (AAA)? true E:\IronRuby\trunk\build\debug>ir array_test Am I a type of what I extended (AAA)? false This has blocked me moving on. Anyone got any ideas? Any help on this would be great! Thanks Ben Blog.BenHall.me.uk
Curt Hagenlocher
2008-Oct-06 05:13 UTC
[Ironruby-core] Annoymous class extending a module doesn''t return expected kind_of
This is working for me with our internal sources but not with what''s current in RubyForge. I think we might be a few days behind on the sync -- you should see it working after the next one happens. -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ben Hall Sent: Sunday, October 05, 2008 6:28 PM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Annoymous class extending a module doesn''t return expected kind_of Hi guys, I''ve been bashing my head again this problem for the last few days where the object I expected wasn''t passed around, tonight I decided to break it down and focus on a much small part. Turns out, I was looking in the wrong part. This is what I think the problem is. The code is creating an anonymous class which is extending a module. The code then does a kind_of? to decide what to do with it.>From what I can tell, it looks like the kind_of doesn''t recognize themodules it is extending. This is the code which demonstrates the problem: Code Repro: module AAA class << self def a puts "Hello" end end def myAAA klass = Class.new do extend AAA end puts "Am I a type of what I extended (AAA)?" puts klass.kind_of?(AAA) end end class XYZ include AAA end $a = XYZ.new $a.myAAA With MRI, true is returned. With IronRuby, false is returned. Output: E:\IronRuby\trunk\build\debug>ruby array_test Am I a type of what I extended (AAA)? true E:\IronRuby\trunk\build\debug>ir array_test Am I a type of what I extended (AAA)? false This has blocked me moving on. Anyone got any ideas? Any help on this would be great! Thanks Ben Blog.BenHall.me.uk _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Stefan Dobrev
2008-Oct-06 06:29 UTC
[Ironruby-core] Annoymous class extending a module doesn''t return expected kind_of
There was a discussion about this some time ago. Here it is: http://rubyforge.org/pipermail/ironruby-core/2008-September/002874.html The reported bug is here: http://rubyforge.org/tracker/?func=detail&aid=21995&group_id=4359&atid=16798 Stefan. 2008/10/6 Ben Hall <ben2004uk at googlemail.com>> Hi guys, > > I''ve been bashing my head again this problem for the last few days > where the object I expected wasn''t passed around, tonight I decided to > break it down and focus on a much small part. Turns out, I was > looking in the wrong part. > > This is what I think the problem is. The code is creating an anonymous > class which is extending a module. The code then does a kind_of? to > decide what to do with it. > > >From what I can tell, it looks like the kind_of doesn''t recognize the > modules it is extending. This is the code which demonstrates the > problem: > > Code Repro: > module AAA > class << self > def a > puts "Hello" > end > end > > def myAAA > klass = Class.new do > extend AAA > end > > puts "Am I a type of what I extended (AAA)?" > puts klass.kind_of?(AAA) > end > end > > class XYZ > include AAA > end > > $a = XYZ.new > $a.myAAA > > > With MRI, true is returned. With IronRuby, false is returned. > > Output: > > E:\IronRuby\trunk\build\debug>ruby array_test > Am I a type of what I extended (AAA)? > true > > E:\IronRuby\trunk\build\debug>ir array_test > Am I a type of what I extended (AAA)? > false > > > This has blocked me moving on. Anyone got any ideas? > > Any help on this would be great! > > Thanks > > Ben > Blog.BenHall.me.uk > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20081006/c4c19f33/attachment.html>
Ben Hall
2008-Oct-06 09:42 UTC
[Ironruby-core] Annoymous class extending a module doesn''t return expected kind_of
Hi Curt, Any ideas when the next release will happen? Is this going to be a post PDC thing? Ben On Mon, Oct 6, 2008 at 6:13 AM, Curt Hagenlocher <curth at microsoft.com> wrote:> This is working for me with our internal sources but not with what''s current in RubyForge. I think we might be a few days behind on the sync -- you should see it working after the next one happens. > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ben Hall > Sent: Sunday, October 05, 2008 6:28 PM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] Annoymous class extending a module doesn''t return expected kind_of > > Hi guys, > > I''ve been bashing my head again this problem for the last few days > where the object I expected wasn''t passed around, tonight I decided to > break it down and focus on a much small part. Turns out, I was > looking in the wrong part. > > This is what I think the problem is. The code is creating an anonymous > class which is extending a module. The code then does a kind_of? to > decide what to do with it. > > >From what I can tell, it looks like the kind_of doesn''t recognize the > modules it is extending. This is the code which demonstrates the > problem: > > Code Repro: > module AAA > class << self > def a > puts "Hello" > end > end > > def myAAA > klass = Class.new do > extend AAA > end > > puts "Am I a type of what I extended (AAA)?" > puts klass.kind_of?(AAA) > end > end > > class XYZ > include AAA > end > > $a = XYZ.new > $a.myAAA > > > With MRI, true is returned. With IronRuby, false is returned. > > Output: > > E:\IronRuby\trunk\build\debug>ruby array_test > Am I a type of what I extended (AAA)? > true > > E:\IronRuby\trunk\build\debug>ir array_test > Am I a type of what I extended (AAA)? > false > > > This has blocked me moving on. Anyone got any ideas? > > Any help on this would be great! > > Thanks > > Ben > Blog.BenHall.me.uk > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >
Ben Hall
2008-Oct-06 09:45 UTC
[Ironruby-core] Annoymous class extending a module doesn''t return expected kind_of
Hi Stefan, Looks like you are working on the same item as me :) This is the last problem I have I think to run unmodified RSpec, well until I hit the next thing :) Ben On Mon, Oct 6, 2008 at 7:29 AM, Stefan Dobrev <stefan.dobrev at gmail.com> wrote:> There was a discussion about this some time ago. > > Here it is: > http://rubyforge.org/pipermail/ironruby-core/2008-September/002874.html > The reported bug is here: > http://rubyforge.org/tracker/?func=detail&aid=21995&group_id=4359&atid=16798 > > Stefan. > > 2008/10/6 Ben Hall <ben2004uk at googlemail.com> >> >> Hi guys, >> >> I''ve been bashing my head again this problem for the last few days >> where the object I expected wasn''t passed around, tonight I decided to >> break it down and focus on a much small part. Turns out, I was >> looking in the wrong part. >> >> This is what I think the problem is. The code is creating an anonymous >> class which is extending a module. The code then does a kind_of? to >> decide what to do with it. >> >> >From what I can tell, it looks like the kind_of doesn''t recognize the >> modules it is extending. This is the code which demonstrates the >> problem: >> >> Code Repro: >> module AAA >> class << self >> def a >> puts "Hello" >> end >> end >> >> def myAAA >> klass = Class.new do >> extend AAA >> end >> >> puts "Am I a type of what I extended (AAA)?" >> puts klass.kind_of?(AAA) >> end >> end >> >> class XYZ >> include AAA >> end >> >> $a = XYZ.new >> $a.myAAA >> >> >> With MRI, true is returned. With IronRuby, false is returned. >> >> Output: >> >> E:\IronRuby\trunk\build\debug>ruby array_test >> Am I a type of what I extended (AAA)? >> true >> >> E:\IronRuby\trunk\build\debug>ir array_test >> Am I a type of what I extended (AAA)? >> false >> >> >> This has blocked me moving on. Anyone got any ideas? >> >> Any help on this would be great! >> >> Thanks >> >> Ben >> Blog.BenHall.me.uk >> _______________________________________________ >> Ironruby-core mailing list >> Ironruby-core at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ironruby-core > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > >
Curt Hagenlocher
2008-Oct-06 14:41 UTC
[Ironruby-core] Annoymous class extending a module doesn''t return expected kind_of
Oh, no -- we''re doing it pretty regularly. I think there''s just been a short delay while we pull in Peter''s work and that we''ll probably push back out in the next two days. We''re totally not optimized for outside contributions at this point, but "working from a single repository" is on someone''s list of commitments for the next year. -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ben Hall Sent: Monday, October 06, 2008 2:43 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Annoymous class extending a module doesn''t return expected kind_of Hi Curt, Any ideas when the next release will happen? Is this going to be a post PDC thing? Ben On Mon, Oct 6, 2008 at 6:13 AM, Curt Hagenlocher <curth at microsoft.com> wrote:> This is working for me with our internal sources but not with what''s current in RubyForge. I think we might be a few days behind on the sync -- you should see it working after the next one happens. > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ben Hall > Sent: Sunday, October 05, 2008 6:28 PM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] Annoymous class extending a module doesn''t return expected kind_of > > Hi guys, > > I''ve been bashing my head again this problem for the last few days > where the object I expected wasn''t passed around, tonight I decided to > break it down and focus on a much small part. Turns out, I was > looking in the wrong part. > > This is what I think the problem is. The code is creating an anonymous > class which is extending a module. The code then does a kind_of? to > decide what to do with it. > > >From what I can tell, it looks like the kind_of doesn''t recognize the > modules it is extending. This is the code which demonstrates the > problem: > > Code Repro: > module AAA > class << self > def a > puts "Hello" > end > end > > def myAAA > klass = Class.new do > extend AAA > end > > puts "Am I a type of what I extended (AAA)?" > puts klass.kind_of?(AAA) > end > end > > class XYZ > include AAA > end > > $a = XYZ.new > $a.myAAA > > > With MRI, true is returned. With IronRuby, false is returned. > > Output: > > E:\IronRuby\trunk\build\debug>ruby array_test > Am I a type of what I extended (AAA)? > true > > E:\IronRuby\trunk\build\debug>ir array_test > Am I a type of what I extended (AAA)? > false > > > This has blocked me moving on. Anyone got any ideas? > > Any help on this would be great! > > Thanks > > Ben > Blog.BenHall.me.uk > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >_______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Ben Hall
2008-Oct-06 15:20 UTC
[Ironruby-core] Annoymous class extending a module doesn''t return expected kind_of
Excellent. I''ll continue with my work around until then :) I''ll go over the changes i''ve made locally and raise bugs where required tonight. Sadly, they are all core so I can''t submit them myself. Cheers Ben On Mon, Oct 6, 2008 at 3:41 PM, Curt Hagenlocher <curth at microsoft.com> wrote:> Oh, no -- we''re doing it pretty regularly. I think there''s just been a short delay while we pull in Peter''s work and that we''ll probably push back out in the next two days. We''re totally not optimized for outside contributions at this point, but "working from a single repository" is on someone''s list of commitments for the next year. > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ben Hall > Sent: Monday, October 06, 2008 2:43 AM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Annoymous class extending a module doesn''t return expected kind_of > > Hi Curt, > > Any ideas when the next release will happen? Is this going to be a > post PDC thing? > > Ben > > On Mon, Oct 6, 2008 at 6:13 AM, Curt Hagenlocher <curth at microsoft.com> wrote: >> This is working for me with our internal sources but not with what''s current in RubyForge. I think we might be a few days behind on the sync -- you should see it working after the next one happens. >> >> -----Original Message----- >> From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ben Hall >> Sent: Sunday, October 05, 2008 6:28 PM >> To: ironruby-core at rubyforge.org >> Subject: [Ironruby-core] Annoymous class extending a module doesn''t return expected kind_of >> >> Hi guys, >> >> I''ve been bashing my head again this problem for the last few days >> where the object I expected wasn''t passed around, tonight I decided to >> break it down and focus on a much small part. Turns out, I was >> looking in the wrong part. >> >> This is what I think the problem is. The code is creating an anonymous >> class which is extending a module. The code then does a kind_of? to >> decide what to do with it. >> >> >From what I can tell, it looks like the kind_of doesn''t recognize the >> modules it is extending. This is the code which demonstrates the >> problem: >> >> Code Repro: >> module AAA >> class << self >> def a >> puts "Hello" >> end >> end >> >> def myAAA >> klass = Class.new do >> extend AAA >> end >> >> puts "Am I a type of what I extended (AAA)?" >> puts klass.kind_of?(AAA) >> end >> end >> >> class XYZ >> include AAA >> end >> >> $a = XYZ.new >> $a.myAAA >> >> >> With MRI, true is returned. With IronRuby, false is returned. >> >> Output: >> >> E:\IronRuby\trunk\build\debug>ruby array_test >> Am I a type of what I extended (AAA)? >> true >> >> E:\IronRuby\trunk\build\debug>ir array_test >> Am I a type of what I extended (AAA)? >> false >> >> >> This has blocked me moving on. Anyone got any ideas? >> >> Any help on this would be great! >> >> Thanks >> >> Ben >> Blog.BenHall.me.uk >> _______________________________________________ >> Ironruby-core mailing list >> Ironruby-core at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ironruby-core >> >> _______________________________________________ >> Ironruby-core mailing list >> Ironruby-core at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ironruby-core >> > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >