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,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1de1981df403322c,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-11-07 07:52:02 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed.stueberl.de!newsr1.ipcore.viaginterkom.de!btnet-peer1!btnet-peer0!btnet-feed5!btnet!news.btopenworld.com!not-for-mail From: "Martin Dowie" Newsgroups: comp.lang.ada Subject: New limited range type? Date: Fri, 7 Nov 2003 15:51:28 +0000 (UTC) Organization: BT Openworld Message-ID: NNTP-Posting-Host: host81-129-48-51.in-addr.btopenworld.com X-Trace: titan.btinternet.com 1068220288 833 81.129.48.51 (7 Nov 2003 15:51:28 GMT) X-Complaints-To: news-complaints@lists.btinternet.com NNTP-Posting-Date: Fri, 7 Nov 2003 15:51:28 +0000 (UTC) X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MSMail-Priority: Normal X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Xref: archiver1.google.com comp.lang.ada:2205 Date: 2003-11-07T15:51:28+00:00 List-Id: Ok, as we're in "my favourite thing I'd like in Ada" season, here's mine... I'd like to be able to declare integer/float/fixed/decimal types that are limited, at both ends, and never raise exceptions, e.g. type Safe_Degrees is digits 6 limited range -180.0 .. +180.0; -- new use of 'limited' such that declare A, B, C : Safe_Degrees; begin B := 170.0; C := 50.0; A := B + C; -- A equals +180.0 after this statement ... end; We limit values like this all the time (we're not allowed exceptions) and although we can write and instantiate generics to help, it's still a pain. Could even prove useful in things like SPARK? Flames welcome! :-)