first proplem:
I have to rewrite the interface-header & implementation to have potential default parameters on the rigth side;
second problem:
how can I find out in the method body that a parameter/argument was passed by the caller and then take an action. i.e. in the call above the omitteda argument is an array of array of double’s, and spezial calculation will take place if the array was passed and a different actions will takes place if the array is not passed as shown.
in OpenVMS Pascal
if present < argument-name > then begin
my-calculation ( argument-name );
end;
(and another problem just detected while I was editing this my problem text::
the previewer used after editing the my content hiddes/ommits all words starting with an < bracket followed by a letter.
This makes it hard to send in i.e. xml fragments. Just try it.
guess I found a solution
1: replace every missing parameter with a 'nil’
2: in the code-body used to check for availability of the parameter use the following
Interface
function present(o:Object):Bollean;
procedure myroutine(p1:string:=‘default’);
Implementation
function present(o:Object):Bollean;
begin
try
var x:=o.GetType;
Result := True;
except
on E: Exception do begin
Result := False:
end;
finally
end;
end;
procedure myroutine(p1:String;p2:=Object);
begin
if present(p1) then actionS();
if present(p2) then actionO();
end;
var s1 := ‘Sepp’;
myroutine(s1,nil);
// instead of a second parameter just pass nil,
// the try catch block of present(px) will return true or false for a nil passed;
// this is far more easy then rewriting all legacy statements
//just add a nil inbetween commans
i.e.
myroutine(,sk1,ar2,ar3,int4);
myroutine(nil,nil,nil,nil,sk1,ar2,nil,ar3,int4);
thank you Patrick
But as we have 1000’s of “if present(arg-name)” in code, I am going to wrap it anyway instead of substituting it everywhere. But I will try in my wrapper your recommendations to make things more easy.