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,38730e01f356adfa X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!oleane.net!oleane!hunter.axlog.fr!nobody From: Jean-Pierre Rosen Newsgroups: comp.lang.ada Subject: Re: types and subtypes Date: Mon, 13 Mar 2006 14:20:43 +0100 Organization: Adalog Message-ID: References: <1142251677.837212.109000@i39g2000cwa.googlegroups.com> NNTP-Posting-Host: mailhost.axlog.fr Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: s1.news.oleane.net 1142258471 29889 195.25.228.57 (13 Mar 2006 14:01:11 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Mon, 13 Mar 2006 14:01:11 +0000 (UTC) User-Agent: Thunderbird 1.5 (Windows/20051201) In-Reply-To: <1142251677.837212.109000@i39g2000cwa.googlegroups.com> Xref: g2news1.google.com comp.lang.ada:3336 Date: 2006-03-13T14:20:43+01:00 List-Id: ada_student@yahoo.com a �crit : > Given, > > subtype Positive is Integer range 1 .. Integer'Last; > type String is (Positive range <>) of Character; > > the following should be illegal, > > subtype Count_To_Ten is Integer range 1 .. 10; > subtype Ten_Characters is String (Count_to_Ten); > > and the following should be legal, instead > > subtype Count_To_Ten is Positive range 1 .. 10; > subtype Ten_Characters is String (Count_to_Ten); > > Why is Count_To_Ten allowed to be an Integer even though > the indices of String are declared as Positives? > Because they are of the same *type*. A subtype does not declare a different type, only a restriction (a *constraint*) on the allowed values. Since the types are the same, the declaration is OK. -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr