From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!mnetor!uunet!husc6!bloom-beacon!oberon!cit-vax!ucla-cs!zen!ucbvax!GWUVM.BITNET!MFELDMAN From: MFELDMAN@GWUVM.BITNET (Mike Feldman) Newsgroups: comp.lang.ada Subject: Redefinition of "=" and related issues Message-ID: <8801021754.AA06224@ajpo.sei.cmu.edu> Date: 1 Jan 88 20:07:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet List-Id: I wonder if anyone in net-land can give an authoritative discussion on the issue of redefinition of the "=" operator. I am often asked about this by students, and have not been able to find an authoritative answer. In preliminary Ada (as described in the 1979 SIGPLAN issue), it was apparently permitted to redefine "=" for any type at all (at least I could find no limitations described there). By the 1980 version of the language (e.g. the original MIL-STD-1815) redefinition of "=" is restricted to limited private types (paragraph 6- Further, in no event is redefinition of ":=" permitted, but the two operations ":=" and "=" are put in the same class in that both are available for private types and both are unavailable for limited types. The consequence is that it is difficult to write certain kinds of packages, such as for rational numbers (the classical example). In this case you'd really like to redefine "=" so that 1/2 = 2/4 (as in mathematics). But normally you'd make the rational type (unlimited) private so as not to lose the ":=" operation. So we have a devilish choice: make the type limited private and write a rather foolish-looking and nonuniform copy operation like ASSIGN(DEST: out RATIONAL; SOURCE: in RATIONAL) in order to get "=" correct, or make the type unlimited private and be forced to write a nonuniform equality-checker like function EQUAL(LEFT, RIGHT: in RATIONAL) return BOOLEAN. (Note that predefined "=" is still available for the user to (mis)use. Both solutions are unsatisfying and create interfaces to straightforward mathematical entities which are nonuniform and unintuitive. So the basic questions are (1) what was the discussion that led up to prohibiting redefinition of "=" except for limited types? and (2) why are "=" and ":=" identified so closely? I do not have the completed new Rationale; I can find nothing in the 1984 draft Rationale that speaks to the issue. Doug Bryan: this might be a good "dear Ada" question. Who can answer?