[Edu-sig] re: Does edu-sig extend to Jython

Patrick K. O'Brien pobrien@orbtech.com
Mon, 19 Aug 2002 21:47:40 -0500


[Kirby Urner]
>
> I think the usual thing with method overloading in Java is to
> accommodate different numbers of arguments of various types,
> e.g. (int int int) verus (int int) or (int int) versus (float
> int) -- all with the same method name (the compiler tells
> them apart by the type signature of the parameters, same as
> in C++).
>
> What I *don't* think any standard Java API is designed to
> accommodate is simple parameter switching, i.e. to catch
> (int a, int b) verus (int b, int a).  Nor even (int a, float b)
> versus (float b, int a).
>
> It *is* possible to code for these multiple variations and
> permutations, but it's entirely customary to burden the class
> user with the job of at least getting the *order* of the
> parameters right.  The multiplicity of methods has to do
> with differences that are *not* at the level of parameter
> ordering alone.
>
> Someone please correct me if I'm wrong about this.

I'm not a Java guy, but your interpretation matches my experience with other
languages that support method overloading. Of course, I think this is in
large part due to the fact that it is relatively rare that the order of
parameters is insignificant, or can be made insignificant through type
checking or method overloading.

--
Patrick K. O'Brien
Orbtech
-----------------------------------------------
"Your source for Python programming expertise."
-----------------------------------------------
Web:  http://www.orbtech.com/web/pobrien/
Blog: http://www.orbtech.com/blog/pobrien/
Wiki: http://www.orbtech.com/wiki/PatrickOBrien
-----------------------------------------------