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=-1.3 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4fb6ec6cd054de65 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-12 22:24:05 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!newsfeed00.sul.t-online.de!t-online.de!fr.usenet-edu.net!usenet-edu.net!enst!enst.fr!not-for-mail From: Christoph Grein Newsgroups: comp.lang.ada Subject: Re: constrained subtypes Date: Wed, 13 Mar 2002 07:22:09 +0100 (MET) Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-Trace: avanie.enst.fr 1016000642 65105 137.194.161.2 (13 Mar 2002 06:24:02 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Wed, 13 Mar 2002 06:24:02 +0000 (UTC) Return-Path: Content-MD5: gCsq3B/GJfPL/lwRJvpuWA== X-Mailer: dtmail 1.2.1 CDE Version 1.2.1 SunOS 5.6 sun4u sparc Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.8 Precedence: bulk X-Reply-To: Christoph Grein List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:21148 Date: 2002-03-13T07:22:09+01:00 > From: Jeffrey Carter > With parentheses, you have an expression, which is of the unconstrained > base subtype (Integer'Base), not the constrained subtype. Expressions > are always evaluated using the unconstrained base type. This allows > things such as > > subtype X is Integer range 1 .. 8; > Y : Integer := 16; > Z : X; > ... > Z := Y / 2; > Y := 3 * Z; > > to be legal. "Y / 2" is not necessarily in X, so a constraint check is > performed before assignment. "3 * Z" is not of subtype X, but is legal, > even though Z is of subtype X, because it is an expression. > > This is why "case Z" and "case (Z)" are different. "Case Y" and "case > (Y)" cover the same range, so you don't see a difference (though it's > there). > Nice exegesis, I also thought it was this way. But when I looked into the RM, I found only: 4.4(7) primary ::= numeric_literal | null | string_literal | aggregate | name | qualified_expression | allocator | (expression) 4.4(9) Each expression has a type; it specifies the computation or retrieval of a value of that type. 4.4(10) The value of a primary that is a name denoting an object is the value of the object. Thus (X) has to be further reduced to X, and then X denotes an object, so where is the difference between "case X is" and "case (X) is"? I would like to see a formal exegesis with the RM.