#378: Macruby 0.5 allows instantiation of a Module instance
---------------------------------------+------------------------------------
Reporter: keith.gautre...@… | Owner: lsansone...@…
Type: defect | Status: new
Priority: minor | Milestone: MacRuby 0.5
Component: MacRuby | Keywords:
---------------------------------------+------------------------------------
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
}}}
YARV:
{{{
a = A.new => 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.meth1 =>"hello"
}}}
I believe the proper behavior (based on the 1.9 pickaxe documentation) is
to allow extending of an object with A's methods but not instantiation.
{{{
a = NSObject.new
a.extend(A)
a.meth1 => "hello"
}}}
Once I figure out how to write specs I'll see if I can submit a failing
one.
--
Ticket URL: <http://www.macruby.org/trac/ticket/378>
MacRuby <http://macruby.org/>
_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel