Calls on member functions on superclasses create a lot of casts
fredreichbier opened this issue · comments
Friedrich Weber commented
See https://github.com/fredreichbier/ooc-lua/blob/master/samples/cache.lua#L9:
When E.hello
is called, howling actually asks the superclass, D
for hello
and gets a function. howling then returns a function that casts its first argument (this
) to D*
and otherwise relays the call to the function it got from D
.
The problem: D
does the same for C
, which does the same for B
, which does the same for A
. So we end up with a function chain that casts its first argument to D*
first, then C*
, then B*
, then A*
. That's four nested functions and casts.
It's not pretty, and might actually cause performance problems.