Error: "superclass mismatch"
DescriptionWhen changing the superclass of a class without first undefining the that class, Ruby 1.9.x will throw an error. There has to be a way to circumvent this problem. Otherwise it will be necessary to rewrite (even if only slightly) a lot of scripts and people don't want that. One of ARC's main selling points is that it is compatible with RMXP scripts, regardless of anything.
I have researched the problem already, but I couldn't find anything.
PriorityCritical.
PrerequisitesNone
AssignedForeverZer0
Blizzard
Everything elseThis piece of code illustrates the problem:
class A
end
class B
end
class C < A
end
class C < B # throws "TypeError: superclass mismatch"
end
Holy shit, I didn't realize newer versions of Ruby did that. That really sucks.
I'll see what I can do.
I mean, it makes sense to do that. But sadly there are scripts (including my own) that won't work with that.
Its not looking good on this one for doing through Ruby. For some reason Ruby decided to go out of its way to prevent this, and it is only possible with modules using "include", but then you lose the metaclass inheritance.
I'm gonna keep trying myself, and do some extensive google work to see what I can come up with.
heres something but im not sure if it removes the entire definition
here (http://rpheath.com/posts/373-ruby-error-superclass-mismatch)
We need a way for it to do that automatically, without knowing the classes ahead of time.
I think we need to find a way of using an intermediate metaclass, but I foresee errors there too.
I can use something like "Object.send(:remove_const, :Game_Player)", that's not the problem. As F0 said, we need an automatic way to do this.
If you can't find anything, I'll try to find that part in the Ruby source, just delete it and compile Ruby without it. Or I can add the constant removal there, it doesn't matter. Though, I'd like to avoid poking around in Ruby's source.
EDIT: Alright, I have simple commented out that piece of code and recompiled Ruby. Task finished.