Hi folk,
maybe someone of you has a better idea.
In OpenVMS PASCAL one can write
myInteger := MAX(p1,p2,p3,p4,p5,p6); // where as p1 to p6 can be off different type and the return is Integer
myDouble := MAX(p1,p2,p3); // where as p1 to p3 can be off different type and the return is Double
in other words,this routines are library routines, and can be used in any direction, not caring on input parameter types, they can be mmixed, as long as they are numeric, and not caring about return type as long as the target parameter is numeric.
I don’t know how they made that at DEC. But I know that my boss hase made heavy use of it; Now I have a problem; But I ask if someone has an Idea how I can make this happen for our big porting project from OpenVMS PASCAL to Oxygene PASCAL without touching existing lines of code but adding wrapper routines MIN and MAX accepting, doing and retunrning like the OpenVMS PASCAL MIN MAX functions.
And to mention the moste lazy one’s: All MIN / MAX nice .NET Math.* routines accept exactly 2 parameters and they need to be of the same type, also the return type is given.
I have a solution for varying amount of parameters and types which works, but the routines need to return the proper types, and here I can not overload in Oxygene, because Overloading works on parameter types;
But I need MAX(params values:array of Object):Int32; So I am passing always an array of objects because the input is of different type and amount; And so Oxygene can not distinguishe which routine to call; as long as it does not also car about the return type to deliver.
Any great ideas is very welcome.
Josef