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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.99.112.85 with SMTP id a21mr14550968pgn.30.1480467593907; Tue, 29 Nov 2016 16:59:53 -0800 (PST) X-Received: by 10.157.56.132 with SMTP id p4mr1458107otc.20.1480467593838; Tue, 29 Nov 2016 16:59:53 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!p16no59941qta.1!news-out.google.com!j8ni250qtc.0!nntp.google.com!p16no59936qta.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 29 Nov 2016 16:59:53 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=174.28.218.229; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 174.28.218.229 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Ada 2012 Constraints (WRT an Ada IR) From: Shark8 Injection-Date: Wed, 30 Nov 2016 00:59:53 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 4876 X-Received-Body-CRC: 2446342615 Xref: news.eternal-september.org comp.lang.ada:32527 Date: 2016-11-29T16:59:53-08:00 List-Id: On Tuesday, November 29, 2016 at 5:03:07 PM UTC-7, Randy Brukardt wrote: > "Shark8" wrote in message=20 > news:f2c50fc6-18e1-48c7-8db7-aca274c74ac7... > > On Tuesday, November 29, 2016 at 10:53:59 AM UTC-7, Niklas Holsti wrote= : > ... > >> > Subtype P2 is Integer > >> > with Static_Predicate =3D> P2 in 1..Integer'Last > >> > or else raise Constraint_Error; > >> > >> Perhaps it was obvious to you, but this differs from Positive in that > >> you cannot write P2'First or similar (illegal by RM 3.2.4(26/3)), but > >> you can write Positive'First. > > > > But insofar as a "type" (the collection of values and operations*) goes= it=20 > > is the same: its > > values have the same range, the operations* are the same, and it raises= =20 > > the same error > > when they are violated. > > > > * Assuming we're considering attributes as something different than an= =20 > > 'operation' and excluding them. >=20 > That's a pretty strange thing to do, IMHO. (And keep in mind the differen= ce=20 > of operation for memberships that I noted previously -- do you want to=20 > exclude that, too??) Is it? Are 'First and 'Last operations of the type? Objects of that type? Both? Ne= ither? Dependent on the type of attribute and/or the type of variable? For example, "Type K array(positive range <>) of integer" doesn't define a = 'First and 'Last operation for the type... even though given "X : K;" X'Fir= st and X'Last are perfectly fine. >=20 > >> > Subtype P3 is Integer with > >> > Static_Predicate =3D> P3 in 1..Integer'Last, > >> > Predicate_Failure =3D> raise Constraint_Error; > >> > >> Same difference as for P2, I think. > >> > > > > So there *IS* something in common about all the above, that's what the= =20 > > thrust of the topic (an Ada IR) is getting at. >=20 > Perhaps we better start back that the beginning. What do you mean by "IR"= ?=20 Intermediate Representation. > I had assumed that you wanted advice for choosing between these possibili= ties, but this message seems to be concentrating on implementing an Ada com= piler.=20 It is only partially about implementing a compiler, it's partly about reall= y understanding Ada, it's also about understanding a good way to represent = the underling concepts. -- A good IR could also provide a good foundation f= or creating a sort of "CPAN for Ada", but amiable to consistency assurance = both in the repository itself [1] and for dependencies themselves. (1) -- I have a friend who uses Perl, in his usage of CPAN he's encountered= corrupted index-files, corrupted archives, and dependency issues. > That seems irrelevant to virtually all Ada users (my advice, as always, w= hen=20 > thinking about starting a new Ada implementation, is DON'T -- no one -- o= r=20 > even a small group -- has the 15 years of effort needed). I'd rather talk= =20 > about things that are relevant. One of the things that a lot of people have said -- survey results here: ht= tps://docs.google.com/spreadsheets/d/1ixr84Q8zif44IxX4x22o6I1UBZ_knu4pp6q4Y= ft5GaI/edit#gid=3D588264163 -- that keeps them from adopting Ada is: (1) a lack of free and low-cost implementations [even here on comp.lang.ada= we have people of much the same opinion WRT AdaCore's perceived monopoly], (2) a [perceived] lack of tools "like lint" or CPAN [I'll admit SPARK is/ha= s a pretty nice set of tools, and that your average Ada implementation alre= ady has huge chunks of that functionality], (3) lack of libraries, or the ability to find them.