From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 14 Oct 92 20:27:30 GMT From: wdl39!mab@ford-wdl1.arpa (Mark A Biggar) Subject: Re: Can I overload ":="? Message-ID: <1992Oct14.202730.8562@wdl.loral.com> List-Id: In article mmaccorm@fox.nstn.ns.ca (Mike Mac Corma ck) writes: >Couldn't you use the type name as type conversion operator? If you had a >type "Complex", and wanted to convert it to a real, couldn't you >overload "real" as follows: > function real(c :Complex) return real; >and then use the statement > r := real(c); >to convert it to a real? This doesn't work because overload resolution only works for subprograms. The above declaration completely hides the type name "real", it doesn't overload it. The above declaration may even be illegal because the function name "real" arleady hides the type name by the time the complier gets to the function return type. Besides the above functions is better called "real_part" to distinguish it form the complementary function "imaginary_part", unless you wanted the modulas in which case overloading "abs" makes more sense. -- Mark Biggar mab@wdl1.wdl.loral.com