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,bdd718faa7c79f29 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-21 20:17:40 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newshub.sdsu.edu!elnk-pas-nf2!newsfeed.earthlink.net!wn14feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc54.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Overlapping ranges References: <5W8Ja.43776$JA5.768297@news.xtra.co.nz> X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc54 1056251858 12.234.13.56 (Sun, 22 Jun 2003 03:17:38 GMT) NNTP-Posting-Date: Sun, 22 Jun 2003 03:17:38 GMT Organization: AT&T Broadband Date: Sun, 22 Jun 2003 03:17:39 GMT Xref: archiver1.google.com comp.lang.ada:39550 Date: 2003-06-22T03:17:39+00:00 List-Id: > Exactly. And that's the problem - I'm looking for a way > to declare a function [and/or whatever] that could handle > values of either of the two [test-bed of course] types and, > on top of that, impose range restrictions on the values passed in. Can you just have two different functions overloading a single name? type x1 is range 0..255; type x2 is range 127..2**15-1; subtype x1_and_x2_range is x1 range 127 .. 255; subtype x2_and_x1_range is x2 range 127 .. 255; function f(x : x1_and_x2_range) return ... function f(x : x2_and_x1_range) return ... an_x1 : x1; an_x2 : x2; ... result := f(an_x1); -- checks an_x1 in 127 .. 255, then calls first "f" result := f(an_x2); -- checks an_x2 in 127 .. 255, then calls second "f"