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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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-20 09:00:18 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!128.230.129.106!news.maxwell.syr.edu!news.mindspring.net!not-for-mail From: Lao Xiao Hai Newsgroups: comp.lang.ada Subject: Re: Types, subtypes and ranges Date: Tue, 20 Mar 2001 08:57:05 -0800 Organization: AdaWorks Software Engineering Message-ID: <3AB78BE0.1C2764C7@ix.netcom.com> References: <97pfmt$ll30@tech.port.ac.uk> <3AB53681.2959BAF7@ix.netcom.com> <3AB5FA4A.1779F976@earthlink.net> Reply-To: richard@adaworks.com NNTP-Posting-Host: 3f.35.b3.5e Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Server-Date: 20 Mar 2001 16:59:19 GMT X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en Xref: supernews.google.com comp.lang.ada:5908 Date: 2001-03-20T16:59:19+00:00 List-Id: "Marc A. Criley" wrote: > > Hmmm, I've never really considered subtypes a "weakening" of the type > slightly, though obviously they could be ill-used to that end. My use > of them has been in fact to tighten up the typing. Often, some programmer will declare a lot of subtypes to avoid some of the strict compile-time type checking on operations. Also, without the need for explicit type conversions, one can blithely assign one type to another without considering the implications, such as potential range constraints at run-time. Granted, one must confront the same issue with derived types that have varying ranges, but we could hope the need for explicit type conversion makes the programmer stop and consider the possible consequences of that action. That being said, the examples you have presented are excellent for demonstrating the intelligent use of subtypes. Richard Riehle