[MacRuby] #1403: Modules included indirectly get included twice
MacRuby
ruby-noreply at macosforge.org
Fri Oct 7 16:17:18 PDT 2011
#1403: Modules included indirectly get included twice
----------------------------------------+-----------------------------------
Reporter: ernest.prabhakar@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: major | Milestone: MacRuby 0.11
Component: MacRuby | Keywords:
----------------------------------------+-----------------------------------
Description changed by ernest.prabhakar@…:
Old description:
> If module Bar includes Foo, then anything that includes Bar includes Foo
> twice.
>
> {{{
> #!/usr/bin/env ruby
> module Foo
> def singleton; class << self; self; end; end
> end
>
> module Bar
> include Foo
> end
>
> class Array
> include Bar
> end
> puts Array.ancestors
> s = "\nDone\n".extend(Bar)
> puts s
> puts s.singleton.ancestors
> }}}
>
> {{{
> prabhaka$ rvm current
> macruby-0.10
>
> prabhaka$ ruby spec/include_test.rb
> Array
> Bar
> Foo
> Foo
> NSMutableArray
> NSArray
> Enumerable
> NSObject
> Kernel
> }}}
> This does not have with 1.8 or 1.9. It may be related to #718
>
> {{{
> prabhaka$ rvm current
> ruby-1.9.2-p180
>
> prabhaka$ ruby spec/include_test.rb
> Array
> Bar
> Foo
> Enumerable
> Object
> Kernel
> BasicObject
> }}}
>
> This occurs whether the module is included in a class or extending an
> instance.
New description:
If module Bar includes Foo, then anything that includes Bar includes Foo
twice.
{{{
prabhaka$ rvm current
macruby-0.10
prabhaka$ ruby spec/include_test.rb
Array
Bar
Foo
Foo
NSMutableArray
NSArray
Enumerable
NSObject
Kernel
}}}
This does not happen with 1.8 or 1.9. It may be related to #718
{{{
prabhaka$ rvm current
ruby-1.9.2-p180
prabhaka$ ruby spec/include_test.rb
Array
Bar
Foo
Enumerable
Object
Kernel
BasicObject
}}}
This occurs whether the module is included in a class or extending an
instance.
{{{
#!/usr/bin/env ruby
module Foo
def singleton; class << self; self; end; end
end
module Bar
include Foo
end
class Array
include Bar
end
puts Array.ancestors
}}}
--
--
Ticket URL: <http://www.macruby.org/trac/ticket/1403#comment:1>
MacRuby <http://macruby.org/>
More information about the macruby-tickets
mailing list