Howto: test if an argument was omitted or passed by caller?

In OpenVMS Pascal the PRESENT function returns a Boolean value that indicates wether the actual argument list of a routine containes an argument that correspondes to a formal parameter. (The function is usually used to supply a default value or to take a default action when the argument for a parameter is omitted.)

How can I test in Oxygene that an argument is omitted or was passed by the caller?

Josef

Josef,
as you must pass arguments, the test will always return true. In .NET, you can define a default value for an argument, in case the caller has not specified one.
Patrick

Hi Patrick,
The answer does not satisfy me. I try to avoid work in our legacy porting project.

So agin: In VB.NET I can have optional parameters of type VARIANT and then in the routine body I can use the "if isMissing(paraname) then … else … end;"
This gives me true or false depending up on a parameter was omitted or passed.

And it is not just default value passing, but action dispatching. In our project (talking about a big legacy port) we have lots of calls with very varying parameter lists for any given implemented routine. hence varying actions will take place. OpenVMS Pascal allows that. Hence we had 25 years ago a need to test for presenc or absence of a actual parameter to i.e. take an action on it or leave it.

In order to avoid over an over new re-implementations in our operator library, I am seeking a way for OpenVMS PAscal Function PRESENT(paraname), which returns ture or false; And I know I can re-implement it using an routine parameter overloading technic; But this ends up in more testing and more work over all;

Hence I try to find a wrapper approach.

Hello,

There is no other way except the way Patrick has mentioned (using default parameters).

Best regards.

so we have to do routine parameter overloading because we have lots of calls to the same routine but with different types and amounts of parameters. very teddious.
and it is not only the value/default value of a parameter which defines the action required. however the presence or absemnce of a parameter is well suited to define / influence the action the routine executes.