Projects

Ticket #371 (closed defect: fixed)

Opened 2 years ago

Last modified 9 months ago

Module methods included in the class Module are not visible to other classes.

Reported by: mred@… Owned by: lsansonetti@…
Priority: blocker Milestone: MacRuby 0.11
Component: MacRuby Keywords:
Cc:

Description

module A
  def b
    puts 'b'
  end
end

class Module
  include A
end

class C
  b()
end

Running the above on Ruby 1.9 prints out 'b'. Running it on MacRuby 0.5 generates an "undefined method `b' for C:Class (NoMethodError)"

Change History

Changed 2 years ago by keith.gautreaux@…

It seems that MacRuby treats modules differently than Ruby 1.9. You shouldn't be able to instantiate a named module using the new method, i.e.

A = Module.new do

def meth1

"hello"

end

end

a = A.new (shouldn't work) => NoMethodError: undefined method `new' for A:Module

but it does in MacRuby returning an instance of A:Module which responds to the meth1 call => #<A:0x2003da160>

a.meth1 =>"hello"

Changed 2 years ago by lsansonetti@…

These are 2 different bugs.

Changed 2 years ago by keith.gautreaux@…

I'm sorry Laurent. I will open a separate ticket for the second bug. Thanks.

Changed 14 months ago by lsansonetti@…

  • milestone set to MacRuby 1.0

Still not working as of trunk. Let's look at this one for 1.0 (tentative).

Changed 9 months ago by kouji@…

Now, these are fixed in HEAD(fbaff4e856e686792775da89e660acc163c5f29f). I think this ticket would be close.

Changed 9 months ago by lsansonetti@…

  • status changed from new to closed
  • resolution set to fixed
  • milestone changed from MacRuby 1.0 to MacRuby 0.11

Verified, closing.

Note: See TracTickets for help on using tickets.