incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Heidegger ...@leichtgewicht.at>
Subject Re: AS3 Enhancements: method overloading. Why do people want this?
Date Mon, 16 Jan 2012 16:41:55 GMT
It COULD be implemented without changing the runtime by using different 
method names or namespaces.
However: to be "mathematically" safe that no mistakes happen they would 
need to be named something like
send<reserved-character>String<reserved-character>org<other-reserved-character>myproject<other-reserved-character>MyType(a:String,

b:MyType);

If it was possible to use namespaces in interfaces in the avm then it 
could be also implemented using namespaces (might result in a smaller swf).

However: there are fundamental problems with a non-runtime solution:

*) describeType would create different results with a swf that supports 
overloading.
*) untyped access would not work properly anymore: var a:* = new 
MyClass(); a["doSomething"]("str") would not work anymore like that

Either would potentially break libraries which is why I was hoping for 
overloading support by the avm for a long time.

yours
Martin.


However: describeType is a runtime method that would unravel this hack.

On 17/01/2012 01:14, Nicholas Kwiatkowski wrote:
> If it would be implemented like it is in Java (not to say that would be the
> case), the runtime method names would be mangled so that they actually are
> different .  (send_ABSJD(), send_JNKFF(), for example)  -- there wouldn't
> be any impact during runtime.  No different than how unnamed functions work
> at the moment.
>
> We would have to wait and see how the compiler handles this today to see
> what and how it could be done.
>
> -Nick
>
> On Mon, Jan 16, 2012 at 10:41 AM, Jonathan Campos<jonbcampos@gmail.com>wrote:
>
>> I would just want to see what the tradeoffs would be for the compiler and
>> code execution before I am really for/against this addition.
>>
>> --
>> Jonathan Campos
>>


Mime
View raw message