I suspect the question had already discussed, nevertheless I want to ask why exact parameter type( not “is type”) is required for function type unification. For example, this code doesn’t compile:
class Test
{
static function main()
{
var f: A -> Void = foo;
}
static function foo(arg: B)
{
trace("foo called");
}
}
class A
{
}
class B extends A
{
}
What’s the elegant solving of this problem except creating a local var with a casting to the descendant type?