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,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,685d80ec307a0c X-Google-Attributes: gid103376,public From: "Pat Rogers" Subject: Re: use of attribute Pos Date: 2000/10/11 Message-ID: #1/1 X-Deja-AN: 680260220 References: <39E4A08D.B454CB1C@laas.fr> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.3018.1300 X-Complaints-To: abuse@swbell.net X-Trace: nnrp1.sbc.net 971290576 208.191.184.67 (Wed, 11 Oct 2000 13:56:16 CDT) Organization: SBC Internet Services X-MSMail-Priority: Normal NNTP-Posting-Date: Wed, 11 Oct 2000 13:56:16 CDT Newsgroups: comp.lang.ada Date: 2000-10-11T00:00:00+00:00 List-Id: "Philippe Torres" wrote in message news:39E4A08D.B454CB1C@laas.fr... > Hi, do you think the following behaviour is normal ? > ----- > subtype Upper is character range 'A'..'Z' ; > begin > Put(Upper'Pos('A')) ; > ----- > Output : 65 > > I was expecting 0 since 'A' is the first element of Upper but i got > the ranking of 'A' in the Character type. > > What's the point of defining constrained subtype if we can't use the > attributes on it ? Or am i missing something ? A subtype does not introduce a new type -- it names a constraint on an existing type. Understand that and all else follows. You can indeed use the attributes on the subtype, but you must recognize that only those attributes that represent *constraints* will be different than those of the actual type in question. Thus Upper'first will yield 'A', Upper'last will yield 'Z', and so on. Its all in the "names for constraints" concept... --- Patrick Rogers Consulting and Training in: http://www.classwide.com Deadline Schedulability Analysis progers@classwide.com Software Fault Tolerance (281)648-3165 Real-Time/OO Languages Adam ... does not deserve all the credit; much is due to Eve, the first woman, and Satan, the first consultant. Mark Twain