You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Normally I can define the same class multiple times. However if one of its included modules uses prepend to add some features, the class gets broken. Observe this code:
module Foo
module Initializer
def initialize
puts 'pre-initialize'
super
puts 'post-initialize'
end
end
def self.included(klass)
klass.send :prepend, Initializer
end
end
class Module
def has_foo
include Foo
end
end
class Bar
has_foo
def initialize
puts 'Bar.initialize'
end
end
class Bar # this is repeated intentionally
has_foo
def initialize
puts 'Bar.initialize'
end
end
Bar.new
If I run this code under regular Ruby (ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]), I'm getting:
pre-initialize
Bar.initialize
post-initialize
However, when run under mruby (latest from master), I'm getting an error:
mruby works fine if I remove the duplicate of Bar. However this is not possible in the system I'm developing (which relies on dynamic reloading of files).
The text was updated successfully, but these errors were encountered:
Normally I can define the same class multiple times. However if one of its included modules uses
prepend
to add some features, the class gets broken. Observe this code:If I run this code under regular Ruby (
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
), I'm getting:However, when run under mruby (latest from master), I'm getting an error:
mruby works fine if I remove the duplicate of Bar. However this is not possible in the system I'm developing (which relies on dynamic reloading of files).
The text was updated successfully, but these errors were encountered: