incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Heidegger ...@leichtgewicht.at>
Subject Re: Method overloading work-around: the problems & possible solution
Date Mon, 16 Jan 2012 17:41:57 GMT
On 17/01/2012 02:30, David Arno wrote:
>      ab.foo(1);         //<- which foo does this call? int, uint or Number?
Right now all integer numbers are treated as regular integers (avm 
doesn't support uint properly).
This means that 1 will be an integer and therefore foo(i:int) would be 
used. "1.0" becomes a number
so foo(n:Number) will be used.
>      ab.foo(null);      //<- and this one? String or Object?
Compile-time error, null is untyped, and there is no untyped method, 
:Object is of a type! Untyped would be :*!
To be clear one would need to write something like:

ab.foo(String(null));
ab.foo(Object(null));

This could also apply to

>      ab["foo"]("");     //<- how do we map this to ab.foo_String_void() ?

If namespaces were supported in interfaces (which I don't know yet) the 
compiler could make
ab.foo[new QName("<reserved-character>String", "foo")]("");

or without namespaces:
ab.foo[str+"<reserved-character>String"]("");

> We put in place a catch-all foo that handles all the situations where the
> compiler cannot work out the mapping at compile time.
For backwards compatibility that is certainly a good idea. Beware of the 
horror of using a swf compiled
with overloading support together with a swf that isn't.

yours
Martin.


Mime
View raw message