I thought we were talking about metamethods. Anyways, subclasses inherit from (optionally) one base class. it’s a one way street. It does not inherit anything else, other than setting its metatable to Rcade.
Also Rcade is a module script. that’s just where the metamethods are located and where you create classes and use Utility. Which you said you like using module scripts for DRY. Why not Rcade?
If you need to inherit you do it inside the class as well in my examples. You have to write the inheritance in with __super. It’s not like they magically inherit something else out of nowhere. And they only inherit from one class, this system does not support multiple inheritance (meaning 1 class inheriting from 2 different classes)
Also, yes an extra layer makes it less readable. While it was a point I made in the tutorial, it’s something I sacrificed (a little) to have a better user experience. Though if you follow the tutorial you should very well understand what the code is trying to do. Some things need a learning curve like anything.
I assume that the issues you have pointed out are
- the extra layer reduces readability
- the metamethods inside Rcade have an effect on every class created through Rcade which is bad?
However, this has had noticeable results in my development. And I’ve seen other OOP concepts outside of LUA that use a third layer. Not saying that would make this system inherently good. However, I don’t agree with your statement. Imagine the third layer like the class implementations that are built in into other coding languages natively. That’s what I was going for anyway.
If you didn’t want metamethods inherited from one place, then sure, don’t add the extra layer. Though subclasses would not inherit metamethods base classes.
The one thing I never figured out how to do was how to have more than one constructor depending on the types of parameters and the amount of parameters. If you had an example of this it would be great since I could try to implement it into the system.
I do like getting your feedback.
Thanks!