Usually operator overloading would transform the expression like
z:=a+b*c;
in something like
z:=a.Add(b.Multiply(c));
If math operations are overloaded like
PROCEDURE "+" (IN x, y: COMPLEX; OUT z: COMPLEX);
z can be expressed as a sequence of two statements
"*"(b,c,tmp);
"+"(a,tmp,z);
And the compiler should be able to transform one statement like z:=a+b*c; in two statements as above internally. Is this what are you saying, Josef?
Georgy
On Sun, Jul 5, 2009 at 4:54 PM, Josef Templ <Josef.Templ{([at]})nowhere.xy
Once again, I am not sure that structured return types are really necessary for
supporting operator overloading on structured types. It seems to me that a very simple convention would also suffice:
Use IN params for the inputs and a single OUT param for the result.
e.g.:
PROCEDURE "+" (IN x, y: COMPLEX; OUT z: COMPLEX);
This has the advantage that it avoids copying the result value in the RETURN statement!
The compiler can transform an expression that contains such operators
in a sequence of procedure calls and it would have to introduce appropriate local variables. I would expect this step to be rather straight forward.
----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy---- To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy
Received on Sun Jul 05 2009 - 17:54:11 UTC