Page 1 of 1
optional parameter
Posted: Mon May 26, 2008 11:06 am
by Polo
Hello,
I hope this hasn't been asked before, it seems using the optional parameter won't work with Tailbite
(with Procedure MyProcedure(parameter=2) for instance.
I think in the past we used to have Procedure2 Procedure3 for this, but now it is native with Purebasic could it be too for Tailbite ?
cheers
Re: optional parameter
Posted: Mon May 26, 2008 10:42 pm
by ABBKlaus
Polo wrote:Hello,
I hope this hasn't been asked before, it seems using the optional parameter won't work with Tailbite
(with Procedure MyProcedure(parameter=2) for instance.
I think in the past we used to have Procedure2 Procedure3 for this, but now it is native with Purebasic could it be too for Tailbite ?
cheers
Sorry, but no. You have to stick with the old fashioned way.
But you could write a procedure with optional paramters and then write some ProcedureDLL/ProcedureDLL2/ProcedureDLL3 ... :
Code: Select all
Procedure MyOptionalParameterTest(A=1,B=2,C=3)
MessageRequester("MyOptionalParameterTest",Str(A)+Str(B)+Str(C))
EndProcedure
ProcedureDLL MyTest()
MyOptionalParameterTest()
EndProcedure
ProcedureDLL MyTest2(A)
MyOptionalParameterTest(A)
EndProcedure
ProcedureDLL MyTest3(A,B)
MyOptionalParameterTest(A,B)
EndProcedure
ProcedureDLL MyTest4(A,B,C)
MyOptionalParameterTest(A,B,C)
EndProcedure
Posted: Tue May 27, 2008 5:51 pm
by Droopy
Posted: Sun Jun 29, 2008 7:15 pm
by Polo
Would it be hard to implement the feature ?
It's so simple with the optionnal parameter that Purebasic proposes !

Posted: Sun Jun 29, 2008 7:37 pm
by ts-soft
Code: Select all
Declare MyTest4(A,B,C)
ProcedureDLL MyTest()
ProcedureReturn MyTest4(1,2,3)
EndProcedure
ProcedureDLL MyTest2(A)
ProcedureReturn MyTest4(A,2,3)
EndProcedure
ProcedureDLL MyTest3(A,B)
ProcedureReturn MyTest4(A,B,3)
EndProcedure
ProcedureDLL MyTest4(A,B,C)
; MyTest(A=1, B=2, C=3) < ----
; your code
EndProcedure
This work for me.
Posted: Sun Jun 29, 2008 7:52 pm
by Polo
This is a workaround but it would be great to have it native

Posted: Sun Jun 29, 2008 8:17 pm
by ts-soft
only the syntax is difference, but the way and the result is the same
