No, it's not. It's much more elegant and separates different algorithms from each other.
The problem is, I'm not trying to do that.
They are the same sub
It's not the same sub, there are 3 subs with same name.
3 different algorithms in 3 different subs
I'm not trying to do that.
In this thread you have posted two examples:
drawbutton(X,Y,Width, Height, ,,, vbBlue) '20 arguments?!?
sub Functionname(optional value as int=-1)
The first one is a good example, what you should avoid in modern algorithms (hint: in this case maybe you can use user types),
I am actually using a user type.
But I try to avoid passing it in the way you're suggesting, as that removes it's ability to be reusable in the way I am using it.
The way you're using overloading, makes it absolutely, completely useless. I can do everything overloading does already by making multiple subs. Which is unorganized/redundant/wasteful/inelegant
I repeat myself, you're asking for something else. Make your own topic. This is not the place to tell me I should be asking for something I dont want.
But what do you do with your optional parameter, when there is no unused value like -1?
-1 is the default value so you can detect that it was missing.
And it's much better to have overloading than nothing, isn't it?
Not in the slightest. Overloading is useless to me. It does nothing that I need of it.
Sorry desolatesoul, but are you not able to read, or do you just prefer to ignore facts that you don't like?
Insults aren't helpful at all, if you're going to do that, just leave the forum entirely.
Maybe you can understand this:
overloading > optional parameters
No they aren't. Overloading is something completely different.
If we can have only one by choice: I would prefer overloading.
If we can have only overloading or nothing ('cause it's much easier to implement): Everyone takes overloading!
You're being extremely rude, coming in to my topic telling me I shouldn't be asking for a standard feature in other programming languages, then insulting the people who agree with me. Make your own topic and ask for it there. You're not being helpful in this one.
Overloading is not easier to implement.
All he has to do, is if a parameter is missing, obtain the default value from the declaration. Overloading would require a lot more work, especially in changing how his intellisense works.
What you're suggesting, is an exponential increase in coding.
For every optional parameter, thats another exponential increase in sub declarations.
With optional parameters, no matter how many parameters you have, its 1 declaration.
Your suggestion solves nothing, since it can be done already