incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com>
Subject Re: AS3 Enhancements: method overloading. Why do people want this?
Date Mon, 16 Jan 2012 21:45:56 GMT



On 1/16/12 6:51 AM, "David Arno" <david@davidarno.org> wrote:


> 
> I'm in full agreement with the above quote. I think it is good that AS3
> doesn't allow method overloading. Yet it is a popular request, so clearly
> other folk disagree with this. I'm therefore curious to know why people are
> requesting what ought - IMO - to be viewed as a bad thing.
> 
To me it is the tradeoff between overloading vs API bloat.  And my main
reason for it is cross-version backward compatibility.  Because of the way
the verifier works, you cannot change the signature of an API without
possible breaking someone.  Even widening the return type is not allowed.

I'm all for using descriptive names instead of overloading where possible,
until you get into situations where the API seems overwhelming because there
are 25 methods that start with "set", and forcing folks to use a descriptive
name for an additional optional parameter you want to add in the next
version doesn't scale.  Soon, the API docs just overwhelm you.

Method overloading seems to contribute to API bloat in Java since every
variant is in the doc, but for Flex I would discourage use of overloading
except for versioning, and try to get the docs to simply reflect which
additional parameters got added in which version.

-- 
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui


Mime
View raw message