comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: discontinuous subtype without aspect
Date: Mon, 29 Jan 2018 17:24:28 -0600
Date: 2018-01-29T17:24:28-06:00	[thread overview]
Message-ID: <p4oafd$di3$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: b7590929-1b5f-4e14-b689-c86999142749@googlegroups.com

"Mehdi Saada" <00120260a@gmail.com> wrote in message 
news:b7590929-1b5f-4e14-b689-c86999142749@googlegroups.com...
> I'm happy that non continuous index subtypes will be allowed,
> but I wonder why
> subtype S is T with STATIC_PREDICATE S in Val1|Val5..Val7
> has been favored instead of plain:
> subtype S is T range Val1|Val5..Val7 ?

Because a range is contigious! That's a basic property of a range. Note that 
we don't allow declaring arrays with predicates because we don't want arrays 
with holes in them (and absolutely don't want slices with different holes in 
them).

I had proposed allowing a "set constraint" rather having static predicates, 
but most people felt it wasn't necessary. (Argubly, it's the range 
constraints that are redundant these days, but history [and arrays] prevent 
getting rid of them altogether.)

> but why not Squares_Array : Array_Type := (for I in Val1..Val3|Val5 => I * 
> I);

".." is a contiguous range.

...because people didn't want set constraints. I still fail to understand 
why, as you point out, a static predicate is not quite a replacement.



  reply	other threads:[~2018-01-29 23:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-28 14:45 discontinuous subtype without aspect Mehdi Saada
2018-01-29 23:24 ` Randy Brukardt [this message]
2018-01-30 17:31 ` Mehdi Saada
2018-01-30 18:15   ` Dmitry A. Kazakov
2018-01-30 22:09   ` Randy Brukardt
replies disabled

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