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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.66.25.45 with SMTP id z13mr8270668paf.22.1379188642126; Sat, 14 Sep 2013 12:57:22 -0700 (PDT) X-Received: by 10.49.133.225 with SMTP id pf1mr213184qeb.6.1379188641914; Sat, 14 Sep 2013 12:57:21 -0700 (PDT) Path: border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news-in-01.newsfeed.easynews.com!easynews.com!easynews!news.glorb.com!z6no2510132pbz.1!news-out.google.com!rn2ni82783pbc.1!nntp.google.com!d5no31361qap.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 14 Sep 2013 12:57:21 -0700 (PDT) In-Reply-To: <7b66c649-3796-41ea-b734-a2b14d2dbac3@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=174.28.152.201; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 174.28.152.201 References: <7b66c649-3796-41ea-b734-a2b14d2dbac3@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <4ae4fa9a-ae46-4a73-ac6d-a578b75f8860@googlegroups.com> Subject: Re: Standard missing a 'Negative' subtype?... From: Shark8 Injection-Date: Sat, 14 Sep 2013 19:57:21 +0000 Content-Type: text/plain; charset=ISO-8859-1 X-Received-Bytes: 1936 X-Original-Bytes: 2101 Xref: number.nntp.dca.giganews.com comp.lang.ada:183363 Date: 2013-09-14T12:57:21-07:00 List-Id: On Saturday, September 14, 2013 2:49:08 AM UTC-6, Martin wrote: > Why is there no "Negative" predefined subtype in package Standard?... Because you don't often need strictly negative numbers... but if you do you could use the following Ada 2012 construct: subtype Negative is Integer with Static_Predicate => Negative not in Natural; Or the more traditional Ada83 Range: subtype Negative is Integer is range Integer'First..Integer'Pred(Natural'First); -- or Integer'First..-1. (I like using use Integer/Natural/Positive attributes when defining things in terms of subtypes because it avoids hardcoded-constants and makes the type/sybtype relations obvious: the definition becomes stated in terms of it's "type-class".)