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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9ed2b1e061ff269d X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!40g2000pry.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Subtypes boundaries Date: Mon, 14 Jun 2010 18:20:36 -0700 (PDT) Organization: http://groups.google.com Message-ID: <067016cf-ee12-422d-85c0-9017cf87f24f@40g2000pry.googlegroups.com> References: <87nhicFa1kU1@mid.individual.net> <87nijlFa1kU2@mid.individual.net> <2b13f46b-65f9-450a-bb66-68c6093791c4@s9g2000yqd.googlegroups.com> <87o1v9FvpjU1@mid.individual.net> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1276564836 25856 127.0.0.1 (15 Jun 2010 01:20:36 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 15 Jun 2010 01:20:36 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 40g2000pry.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:11740 Date: 2010-06-14T18:20:36-07:00 List-Id: On Jun 14, 6:05=A0pm, Nobody wrote: > On Tue, 15 Jun 2010 01:31:47 +0200 Yannick Duch=EAne (Hibou57) wrote: > > > [ARM 2005 3.5(5)] just says: > >> For a subtype_indication containing a range_constraint, either directl= y > >> or as part of some other scalar_constraint, the type of the range shal= l > >> resolve to that of the type determined by the subtype_mark of the > >> subtype_indication. > > The annotated ARM says: > > 3.5 Scalar Types, 8.a > Ramification: Only range_constraints (explicit or implicit) impose > conditions on the values of a scalar subtype. The other > scalar_constraints, digit_constraints and delta_constraints impose > conditions on the subtype denoted by the subtype_mark in a > subtype_indication, but don't impose a condition on the values of the > subtype being defined. Therefore, a scalar subtype is not called > constrained if all that applies to it is a digits_constraint. Decimal > subtypes are subtle, because a digits_constraint without a > range_constraint nevertheless includes an implicit range_constraint. > > What I understand is that a subtype shall in maximum contain all values > of the subtype indicator, i.e. the superordinated type. Therefore the > definition > > type ASTERIX range +5_000..10_000; > subtype IDEFIX is ASTERIX range 1..20_000; > > should in ANY case cause a compile time error!!! 3.5(8), which you're reading, is in a "Dynamic Semantics" section. Whatever you see there explains how the program will behave at run time. Nothing in a Dynamic Semantics section should ever affect whether you get an error at compile time or not, I think. The rules that cause compile-time errors are in "Legality Rules" sections, and perhaps in "Static Semantics". As for why this would cause an error at run time but not at compile time, I've tried to explain already why it might be a good idea to have the language rules this way. What this means is that if your compiler tells you that something you wrote will raise an exception at run time, take it seriously, as seriously as you'd take an actual error. -- Adam