[Gambas-user] Method Overloading (reprise)

Brant Wells bwells at ...475...
Wed Jan 19 14:39:17 CET 2005


Hey Rob:

This is true about the code not being optimised.  I'm not at all familiar with 
C++ or much of any other programming language...  I'm a basic man all the 
way... Ha haha.

It makes sense though, that there could be a notable speed increase with some 
type of method overloading...  Would be nice to be able to tinker with it in 
Gambas... 

(I've Used VB 3 - 6 [cough, cough], and am unaware as to whether or not it 
supports method overloading...)

See Ya !
~Brant
On Monday 17 January 2005 01:54 pm, Rob Kendrick wrote:

> I've never found it so, in any of the languages I've used it in.  How
> could it be confusing?  You just think of the parameter type list as
> part of the function name.
>
> > Why not just do
> >
> > Sub mysub(myarg as variant)
> >  if isnumeric(myarg) then
> >   'do something to the number
> >  else
> >   'do something to the string
> > end
>
> This can't be optimised at compile or link time, unlike overloaded
> functions.  (ie, in C++, the linker knows exactly where the right
> function is, so the code that's generated is just a jump there, your way
> requires jumping to one function, and then code executed to do the same
> thing, so it's not as quick.)




More information about the User mailing list