[Gambas-user] Method Overloading (reprise)
Julien Barbier
julien at ...782...
Tue Jan 18 08:47:10 CET 2005
Don't forget, in C/C++ and other stuff like this, you don't have a
variant type ! (maybe in object oriented language, ok, with an Object
class, but it's kindly different).
Variant type is not the most optimized way to work with I think.
Julien
On Mon, 2005-01-17 at 19:54, Rob Kendrick wrote:
> Brant Wells wrote:
> > Thanks for the explanations, y'all.
> >
> > I understand it... but couldn't that get confusing if you have two methods or
> > functions with the same name??
>
> 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.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20050118/7d4e2ea9/attachment.html>
More information about the User
mailing list