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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9ab1bf4be2d855dd X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-12 22:54:12 PST Path: supernews.google.com!sn-xit-03!supernews.com!news-feed.riddles.org.uk!skynet.be!newsfeed1.funet.fi!newsfeeds.funet.fi!nntp.inet.fi!central.inet.fi!inet.fi!read2.inet.fi.POSTED!not-for-mail From: "Anders Wirzenius" Newsgroups: comp.lang.ada References: <97pfmt$ll30@tech.port.ac.uk> <98idi9$66g$1@hobbes2.crc.com> Subject: Re: Types, subtypes and ranges X-Newsreader: Microsoft Outlook Express 4.72.3110.5 X-Mimeole: Produced By Microsoft MimeOLE V4.72.3110.3 Message-ID: <4hjr6.34$6Z3.1464@read2.inet.fi> Date: Tue, 13 Mar 2001 06:40:00 GMT NNTP-Posting-Host: 194.251.142.2 X-Trace: read2.inet.fi 984465600 194.251.142.2 (Tue, 13 Mar 2001 08:40:00 EET) NNTP-Posting-Date: Tue, 13 Mar 2001 08:40:00 EET Organization: Sonera corp Internet services Xref: supernews.google.com comp.lang.ada:5674 Date: 2001-03-13T06:40:00+00:00 List-Id: David C. Hoos, Sr. wrote in message <98idi9$66g$1@hobbes2.crc.com>... >Because TTT'Image is inherited from its base type T. > >If you had declared TT and TTT as new T types, the constraint >error would have occurred, but then you wouldn't have been >able to add anders to banders without type conversion, because >the types would have been distinct. Thanks I deleted my former code but include my further studies on the subject. It showed me that the 'Image attribute is inherited all the way up as long as you don't break the chain of subtypes: with Ada.Text_IO; procedure Why_Not_Constraint_Error is type T is new Integer; subtype TT is T range -2..-1; subtype TTT is T range -1..+1; subtype TTTT is TTT range -1..0; subtype TTTTT is TTTT range 0..0; anders : TT := -2; bnders : TTTT := 0; use Ada.Text_IO; begin Put ( TTTTT'Image ( anders+bnders ) ); end Why_Not_Constraint_Error; Anders