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.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC 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!rochester!pt.cs.cmu.edu!sei!sei.cmu.edu!firth From: firth@sei.cmu.edu (Robert Firth) Newsgroups: comp.lang.ada Subject: Re: Constrained Boolean Message-ID: <1039@aw.sei.cmu.edu> Date: Mon, 20-Apr-87 09:01:34 EST Article-I.D.: aw.1039 Posted: Mon Apr 20 09:01:34 1987 Date-Received: Tue, 21-Apr-87 00:37:30 EST References: <3280@burdvax.PRC.Unisys.COM> <3283@burdvax.PRC.Unisys.COM> Sender: netnews@sei.cmu.edu Reply-To: firth@bd.sei.cmu.edu.UUCP (PUT YOUR NAME HERE) Organization: Carnegie-Mellon University, SEI, Pgh, Pa List-Id: In article <3283@burdvax.PRC.Unisys.COM> eric@burdvax.PRC.Unisys.COM (Eric Marshall) writes: >last night I wrote: >> >> The elaboration of 'a' below will not raise CONSTRAINT_ERROR. >> >> subtype bool is boolean range true..true; >> a : bool := true xor false; > > This is a poor example, although my point is correct, XOR >will not always raise CONSTRAINT_ERROR. Below is a more appropriate >example: > > subtype bool is boolean range false..false; > a, b : bool := false; > c : bool := a xor b; You're right, Eric, and I made a rather stupid error. The original discussion was about a Boolean subtype constrained to one value. Indeed, XOR works iff that one value is FALSE, since FALSE xor FALSE yields FALSE. In the case of XOR between arrays, the code then becomes something like if BOOLEAN_SUBTYPE'FIRST = TRUE then raise CONSTRAINT_ERROR; else null; -- never any need actually to DO the assignment! end if; (I hope)