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 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!sri-spam!nike!ucbcad!ucbvax!ADA20.ISI.EDU!BBardin From: BBardin@ADA20.ISI.EDU (John Prentice) Newsgroups: net.lang.ada Subject: Re: Predefined OPerators Message-ID: <8610162018.AA22527@ucbvax.Berkeley.EDU> Date: Thu, 16-Oct-86 13:03:13 EDT Article-I.D.: ucbvax.8610162018.AA22527 Posted: Thu Oct 16 13:03:13 1986 Date-Received: Thu, 16-Oct-86 23:39:53 EDT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet List-Id: I know this subject may be getting a bit old, but I would like to take exception to the position that the '*' operator defined in Standard represents an exception to the rule (ARM 3.3.3(2)) defining the location of the declaration of predefined operators. Given: 1 procedure Not_Immediately_After is 2 type F1 is delta 1.016 range 0.0 .. 1_000.0; 3 type F2 is delta 2#0.1#E-3 range 0.0 .. 1_000.0; 4 X : F1 := 1.0; 5 Y : F2 := 2.0; 6 begin 7 X := F1 (Standard."*"(X,Y)); 8 end Not_Immediately_After; The assertion seemed to be that the operator '*' referenced on line 7 is a predefined operator for type F1 or F2 (or both). If this were true, then clearly we have an exception to the rule for predefined operators since F1 and f2 are both defined in 'Not_Immediately_After' while the operator '*' is defined in Standard (and hence the legality of the reference to 'Standard."*"'). I think the correct interpretation of this situation is that the operator refereced on line 7 was not predefined for type F1 or F2, but is predefined for the type 'universal_fixed' which is declared in Standard (ARM C-3(11)): -- The type 'universal_integer' is predefined. The only operators -- declared for this type are: -- function "*" (Left : 'any_fixed_point_type'; Right : 'any_fixed_point_type') -- return 'universal_fixed'; Thus the declaration of the predefined operator '*' does indeed follow immediately after the declaration of the type. The anomaly here is that the function '*' seems to be a polymorphic function--it accepts arguments of (potentially) many different types. Now I have a question: What is the rational for having this single polymorphic function in a language as strongly typed as Ada? Could the ARM read: -- function "*" (Left : 'universal_fixed'; Right : 'universal_fixed') -- return 'universal_fixed'; and state that a call to this function with any fixed point type would result in an implicit conversion of that type to 'universal_fixed'? The implicit conversion would seem to me to be less inconsistent than a polymorphic function. John Prentice, Hughes Aircraft -------