incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicholas Kwiatkowski <>
Subject Re: AS3 Enhancements: method overloading. Why do people want this?
Date Mon, 16 Jan 2012 15:02:27 GMT
While I'm no prueist OOP chest-beater, I would love to see method
overloading.  I deal a lot with back-end communication systems, and one
thing I hate doing over, and over, and over again are methods like :

public function sendAsString(stringToSend:String):bool
public function sendAsBool(boolToSend:Boolean):bool
public function sendAsArray(arrayToSend:Array):bool
public function sendAsInt(intToSend:int):bool

All of the code within those functions is EXACTALLY the same.  This also
means that the API is much easier, and allows the constitution between the
component and the base-application to be much easier to implement and
easier to understand.  It also helps with a lot of our "convert it to a
generic and convert it back later" that we have to deal with over and over
again in the SDK.

We should be able to do the following :

public function send(itemToSend:String):bool
public function send(itemToSend:Boolean):bool
public function send(itemToSend:Array):bool
public function send(itemToSend:int):bool

which would make the call as simple as  :   myComponent.send(anything);


On Mon, Jan 16, 2012 at 9:53 AM, Martin Heidegger <>wrote:

> Overloading is the a way to implement two interface with conflicting
> arguments for the same method:
> interface A {
>   function test(a: String): void;
> }
> interface B {
>  function test(b:int):void;
> }
> class C implements A,B {
>  function test(a:String):void {};
>  function test(b:int):void {};
> }
> Without it relying on interfaces might be a stressful thing.
> yours
> Martin.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message