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-Thread: 103376,1552407353207252 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread3.news.pas.earthlink.net.POSTED!a6202946!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Range constraints on subprogram parameters? References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <8In%e.1748$4h2.945@newsread3.news.pas.earthlink.net> Date: Sat, 01 Oct 2005 03:50:28 GMT NNTP-Posting-Host: 67.3.213.176 X-Complaints-To: abuse@earthlink.net X-Trace: newsread3.news.pas.earthlink.net 1128138628 67.3.213.176 (Fri, 30 Sep 2005 20:50:28 PDT) NNTP-Posting-Date: Fri, 30 Sep 2005 20:50:28 PDT Xref: g2news1.google.com comp.lang.ada:5320 Date: 2005-10-01T03:50:28+00:00 List-Id: Randy Brukardt wrote: > Actually, Bobby was correct. The reason you can't have subtype constraints > in a parameter declaration is because they aren't required to be static. The > problem is one of conformance when you have separate specifications and > bodies. If F is an integer-returning function that returns 1 the first time > it is called, 2 the second tine, and so on, what is the range of the > parameter P? Now you're talking about some language other than Ada. The reason you can't have subtype constraints in a parameter declaration is because Ada doesn't allow them :) I'm sure you could design a language that does allow them, though your example makes it hard to see how the language could also have separate specifications and bodies. > This is why Ada 200Y allows null exclusions in parameters: because they > always have to be static. We talked a bit aboult allowing static constraints > in subprogram parameter declarations, but didn't do it because that seemed > even more arbitrary than not allowing them at all. Reminds me of index expressions in FORTRAN 66: some operations were permissible and others not, with the effect that they were generally avoided all together. Requiring subtype constraints to be static in some cases and not in others might result in something similar. -- Jeff Carter "Now go away or I shall taunt you a second time." Monty Python & the Holy Grail 07