I've got a bit of a problem with the `->() lfun. To illustrate,
consider the following class:
---8<--
class Base
{
mixed `->(string x)
{
return
(x == "add_one" && lambda(int x) { return x+1; }) ||
(x == "add_two" && lambda(int x) { return x+2; });
}
}
---8<---
I now have a class which allows me to do Base()->add_one(7) to get 8,
and Base()->add_two(7) to get 9. So far so good.
Now, let's try to specialize this class:
---8<---
class Sub
{
inherit Base;
string add_two(int x) { return x+"two"; }
}
---8<---
FAIL! Sub()->add_two(7) still returns 9. And what's more, even if I
try to add something with a name that doesn't exist in Base, I still
can't access it outside of Sub.
Is there a way around this? I tried using `::->() as a fallback in
`->(), but it didn't have the desired effect.