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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4961da398a273222 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-02-09 09:30:10 PST Path: nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!gw1.att.com!fnnews.fnal.gov!uwm.edu!news.alpha.net!news.mathworks.com!uunet!portal.austin.ibm.com!bocanews.bocaraton.ibm.com!watnews.watson.ibm.com!ncohen From: ncohen@watson.ibm.com (Norman H. Cohen) Newsgroups: comp.lang.ada Subject: Re: Ada self-referential operators Date: 9 Feb 1995 17:30:10 GMT Organization: IBM T.J. Watson Research Center Distribution: world Message-ID: <3hdjf2$12km@watnews1.watson.ibm.com> References: <3gnkjb$gso@miranda.gmrc.gecm.com> <3grqrf$jkd@gnat.cs.nyu.edu> Reply-To: ncohen@watson.ibm.com NNTP-Posting-Host: rios8.watson.ibm.com Date: 1995-02-09T17:30:10+00:00 List-Id: In article , jgv@swl.msd.ray.com (John Volan) writes: |> Realize that the relationship between "=" and "/=" is *unique* within |> Ada. Sad but true. I wish the ordering operators worked analogously: For two operands of a given type T and a result of type Boolean, you would be allowed to define (or override a predefinition) of exactly one of "<", ">", "<=", or ">=", and the others would be implicitly defined for you. If the programmer chose to define "<", the others would be implicitly defined as follows: function ">" (Left, Right: T) return Boolean is begin return Right < Left; end ">"; function "<=" (Left, Right: T) return Boolean is begin return Left < Right or Left = Right; end "<="; function ">=" (Left, Right: T) return Boolean is begin return Right < Left or Right = Left; end ">="; If the programmer chose to define "<=", the others would be implicitly defined as follows: function "<" (Left, Right: T) return Boolean is begin return Left <= Right and Left /= Right; end "<"; function ">" (Left, Right: T) return Boolean is begin return Right <= Left and Right /= Left; end ">="; function ">=" (Left, Right: T) return Boolean is begin return Right <= Left; end ">="; This would only be allowed for types with an "=" operator (nonlimited types and limited types with programmer-defined "="). (For some relations it may be most straightforward to define "<" explicitly, but for others, such as set containment, it is more straightforward to define "<=" explicitly. Note that we do NOT define A>=B, for example, to be equivalent to not(A