comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam@spam.com>
Subject: Re: Range constraints on subprogram parameters?
Date: Sat, 01 Oct 2005 03:50:28 GMT
Date: 2005-10-01T03:50:28+00:00	[thread overview]
Message-ID: <8In%e.1748$4h2.945@newsread3.news.pas.earthlink.net> (raw)
In-Reply-To: <l5qdnVOvLLT2faDeRVn-ow@megapath.net>

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



  reply	other threads:[~2005-10-01  3:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-28 20:00 Range constraints on subprogram parameters? Bobby D. Bryant
2005-09-29  5:39 ` Jeffrey R. Carter
2005-09-29  8:30   ` Peter Hermann
2005-09-29  9:06     ` Martin Dowie
2005-09-29 18:16     ` Jeffrey R. Carter
2005-09-30  2:23     ` Bobby D. Bryant
2005-09-30  5:46       ` Jeffrey R. Carter
2005-10-01  1:07         ` Randy Brukardt
2005-10-01  3:50           ` Jeffrey R. Carter [this message]
2005-10-01 14:36           ` Robert A Duff
2005-10-01 14:41             ` Robert A Duff
2005-09-30  2:24   ` Bobby D. Bryant
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox