[Finished] [RGSS] Error: "superclass mismatch"

Started by Blizzard, May 15, 2011, 06:01:56 pm

Previous topic - Next topic

Blizzard

May 15, 2011, 06:01:56 pm Last Edit: September 10, 2011, 03:25:35 am by Blizzard
Error: "superclass mismatch"




Description

When 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.



Priority

Critical.



Prerequisites

None



Assigned

ForeverZer0
Blizzard



Everything else

This piece of code illustrates the problem:
class A
end
class B
end
class C < A
end
class C < B # throws "TypeError: superclass mismatch"
end
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

ForeverZer0

Holy shit, I didn't realize newer versions of Ruby did that. That really sucks.
I'll see what I can do.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Blizzard

I mean, it makes sense to do that. But sadly there are scripts (including my own) that won't work with that.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

ForeverZer0

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.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

nathmatt

heres something but im not sure if it removes the entire definition
here
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


ForeverZer0

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 am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Blizzard

May 16, 2011, 11:40:39 am #6 Last Edit: May 19, 2011, 12:50:59 pm by Scorpion
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.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.