From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:a0c:e1d2:: with SMTP id v18mr960992qvl.14.1616013676433; Wed, 17 Mar 2021 13:41:16 -0700 (PDT) X-Received: by 2002:a25:9d89:: with SMTP id v9mr658877ybp.277.1616013676289; Wed, 17 Mar 2021 13:41:16 -0700 (PDT) Path: eternal-september.org!reader02.eternal-september.org!news.uzoreto.com!2.eu.feeder.erje.net!feeder.erje.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 17 Mar 2021 13:41:16 -0700 (PDT) In-Reply-To: <424f7220-abba-49df-8160-17851c336999n@googlegroups.com> Injection-Info: google-groups.googlegroups.com; posting-host=146.5.2.231; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 146.5.2.231 References: <89128f73-fcc5-4e57-8067-d09877ba0211n@googlegroups.com> <6ca041f3-2669-4497-9548-2f17666702a6n@googlegroups.com> <26c44e00-a899-455a-a929-1e23c7935fe3n@googlegroups.com> <9abb081d-a323-466d-9ae8-a2fc8fa24725n@googlegroups.com> <424f7220-abba-49df-8160-17851c336999n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <08b15573-0197-4b6e-9411-d0ca0f627f62n@googlegroups.com> Subject: Re: array from static predicate on enumerated type From: Shark8 Injection-Date: Wed, 17 Mar 2021 20:41:16 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:61601 List-Id: On Wednesday, March 17, 2021 at 1:08:36 PM UTC-6, Matt Borchers wrote: > Shark8,=20 >=20 > I have read all posts in this thread and I'm pretty sure I understand the= holey array and slice problem and I do not want holey arrays. Your example= is interesting but it adds a lot of complexity. However, that could obviou= sly be abstracted away.=20 >=20 > My comment was not a request but a question just as you posed: why "some = sort of automatically generated function that is invisibly integrated into = this object" to do the mapping is not possible for the implementations of t= he 'Pos, 'First, 'Last, etc. attributes. "This object" being an enumerated = sub-type with a Static_Predicate. Because it's undefined, and the operations prohibited. You're jumping from "Let's have a continuous function" to "we can define di= vision by zero as something useful." And you can... but not automatically, and when someone brings up the functi= on F(x) =3D 1/x and says "well, we have to resolve this issue, as the limit= to zero comes from negative it becomes -Infinity, but from positive it bec= omes positive Infinity." The same thing is happening here: you're saying that 'pos, 'succ, etc could= be defined -- and that's true -- but you're ignoring the underlying proble= ms. Having something like "P : Constant Array (Primes) of Natural;" could indee= d be useful, but what would P(12) be? If Primes'Succ(11) =3D 13, then what = is Primes'Pred(2)? [This latter is a good example because in String manipul= ation, the 0 value is used for indicating things like "not-found", and we a= bsolutely can say SUBTYPE INDEXER IS VALUE'First..INDEX(VALUE, "NOEXIST"); = and have it be sensible when INDEXER is the null-range.] >=20 > I was originally trying/hoping to create a collapsed array needing only t= he minimal memory required to support the Static_Predicate sub-type as the = index. In my previous post I began to realize that solving this inconsisten= cy just might result in a different inconsistency and I would not be in fav= or of a solution like that. Use type-system and/or PRIVATE- & implementation-parts.