Page 2 of 2

Re: Procedure's default argument bypass Request

Posted: Fri Mar 22, 2013 11:51 pm
by Joakim Christiansen
Danilo wrote:Empty expressions would be the same:

Code: Select all

Ax(100,200, , , , ,4)
Ax(100,200,,,,,4)
+2 to this feature!

Re: Procedure's default argument bypass Request

Posted: Sat Mar 23, 2013 5:14 am
by MachineCode
+3 for empty params ("first,,,,fifth"). That's how Commodore BASIC did it, which I grew up with. :)

Re: Procedure's default argument bypass Request

Posted: Sun Mar 24, 2013 12:45 pm
by moogle
+1, been using this in VBA for a while.

Re: Procedure's default argument bypass Request

Posted: Sun Mar 24, 2013 1:03 pm
by Shield
I'd be in favor of named parameters as it's just more clear.

(Actually I'm in favor of being able to overload procedures, but I'm pretty sure we won't get that
at least for a very long time, so... :wink: )

Re: Procedure's default argument bypass Request

Posted: Sun Mar 24, 2013 11:42 pm
by BorisTheOld
Shield wrote:I'd be in favor of named parameters as it's just more clear.
I agree. And as you say, it's a good way to simulate overloading.

Statements such as:

Code: Select all

Result = Format(Integer=x, Mask=y)
Result = Format(Double=x, Mask=y)
are much easier to read, and less prone to error, than:

Code: Select all

Result = Format(,,,,,,x,,,,,,y)
Result = Format(,,,,,x,,,,,,,y)
Something to remember is that blank or missing operands can create problems if passed by value, since it's impossible to tell the true meaning of a value. Is it the value of the operand, or is it a marker to show that the operand is blank? Operands passed by reference are easier to manage, since a zero address indicates the absence of a value.

Re: Procedure's default argument bypass Request

Posted: Mon Mar 25, 2013 1:57 am
by ozzie
BorisTheOld wrote:Something to remember is that blank or missing operands can create problems if passed by value, since it's impossible to tell the true meaning of a value. Is it the value of the operand, or is it a marker to show that the operand is blank? Operands passed by reference are easier to manage, since a zero address indicates the absence of a value.
"Blank or missing operands" should not be a problem, because parameters may only be omitted if they have a default value in the Procedure definition. That is the way it has been in VB6 for years and works well. However, having said that I'm certainly in favor of named parameters - which is a feature VB6 doesn't have!

Re: Procedure's default argument bypass Request

Posted: Mon Mar 25, 2013 2:49 am
by charvista
And I prefer the use of asterisks, as showed at the top of this thread.
After all, Fred will decide, if ever this feature will be implemented. If both asterisks/blanks and named variables are going to be implemented, then everybody will be happy :wink:

Re: Procedure's default argument bypass Request

Posted: Mon Mar 25, 2013 7:43 pm
by gnasen
I stumbled upon this different times. If I only want to set one of the last optional parameters, I have to look up all standard settings of the parameters before this one. It would make things a lot easier!