![]() |
||
|
On 12/6/06, Ivan Smirnov <[email protected]> wrote:Hello everyone, I've come up to the problem of 'true' inheritance realization in Lua recently. Being correctly implemented, this can give you a full control over data inheritance and storage.
I see the mechanism you want to implement, but I cannot think of the practical problem(s) which it solves. Could you provide a concrete, real life design issue, which is solved in a smarter way by your framework?
Besides, beware that subtyping in records is a very tricky issue, easily leading to unsound programs:
http://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)
You might also be interested into looking at Scala, which gives users a fine control on subtyping: http://scala.epfl.ch . It illustrates how tricky class variance is, when you want to do it soundly.