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=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a24:f707:: with SMTP id x7-v6mr3993376ith.11.1532749951684; Fri, 27 Jul 2018 20:52:31 -0700 (PDT) X-Received: by 2002:aca:eb15:: with SMTP id j21-v6mr174336oih.6.1532749951514; Fri, 27 Jul 2018 20:52:31 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!feeder4.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!g2-v6no2410680itf.0!news-out.google.com!l67-v6ni1688itl.0!nntp.google.com!d7-v6no2391512itj.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 27 Jul 2018 20:52:31 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=47.185.195.62; posting-account=zwxLlwoAAAChLBU7oraRzNDnqQYkYbpo NNTP-Posting-Host: 47.185.195.62 References: <72ccb7fa-a9cb-42e6-8c29-3c06da281a45@googlegroups.com> <2212eb54-cb4a-446f-9cdf-287ef220e2c2@googlegroups.com> <1b5a58b2-65b7-4df8-80b5-03e208d249e1@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <8d3444a9-0865-4a7b-8377-0027d20d74f1@googlegroups.com> Subject: Re: Ada Distilled by Richard Riehle From: "Dan'l Miller" Injection-Date: Sat, 28 Jul 2018 03:52:31 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:53996 Date: 2018-07-27T20:52:31-07:00 List-Id: On Friday, July 27, 2018 at 3:07:21 PM UTC-5, Dmitry A. Kazakov wrote: > On 2018-07-27 20:52, Dan'l Miller wrote: > > On Friday, July 27, 2018 at 12:11:31 PM UTC-5, Shark8 wrote: > >> On Friday, July 27, 2018 at 8:30:36 AM UTC-6, rabbi...@gmail.com wrote= : > >>>> That's what I think; but there's also a surprising amount of it that= 's about sets, too. > >>> > >>> In what way? Off hand I can't see where I've used that at all. > >> > >> The most obvious one is the TYPE / SUBTYPE relationship: > >> TYPE: A set of values, and a set of operations on those values. > >> SUBTYPE: A TYPE with an additional set of restrictions constraining th= e values. > >> > >> Another was the CASE statement and its required coverage. > >> > >> A third [IIRC; this may have been my own realization] had to do with v= isibility being treated as a set > >> [of sets]: if a name exists uniquely, then that is legal; if there is = no existence at all, it's a case of > >> either mistaking the name or forgetting to WITH the dependency; if the= re are multiple existences > >> then the compiler must error-out and demand a qualified name, renaming= , or other such resolution. > >> {Extendible to overloading; which is a set of names distinguished usua= lly by parameter- or > >> return-types.} > >> > >>> > >>>> Would you happen to recall what Richard said that so convinced you a= bout it? > >>> > >>> I don't recall his exact words. To me the fact that I can uniquely ta= ilor each type to the real world. > >=20 > > Yes, implicitly those are sets (and sets of sets), especially to compli= er writers, but in Ada today =E2=80=A2=E2=80=A2how > > is that different=E2=80=A2=E2=80=A2 than, say, C++ or OCaml or Rust or = any other language that purports itself to be > > strongly-typed, especially to the app-domain programmer or library prog= rammer. >=20 > Ada has subtypes (domain set constraining/specialization) other=20 > languages have only extension (domain set product). Constraining allows= =20 > a lot of things beyond ranged numbers to be expressed in a regular and=20 > natural way, e.g. unconstrained arrays, variants etc. >=20 > And in Ada we can use combinations of both, which is quite powerful,=20 > almost everybody uses discriminants with tagged types without even=20 > thinking about it. >=20 > > Conversely, if Ada'Succ or Ada++ or AdaNG or hypoAda/Ada/hyperAda (or w= hatever its name would be) > > would embrace overt set operations* over the sets of types, subtypes, c= lass-trees, and so forth at > > either compile-time or run-time or both, now that might lead to an inte= resting destination of > > super-dooper Ada++ doing something special & useful that no** other lan= guage can do, including > > current Ada. >=20 > Ada already has sets of types in two forms: generics and classes. For=20 > users the second form is limited to only tagged types. That should be=20 > fixed, no doubt. >=20 > > A smidgeon in this direction historically, Z.200 CHILL as Ada's almost-= unreadable Steelman-esque > > alter ego had set & power-set as 1st-class citizens along with array an= d had grant/revoke*** > > operations on sets of types as something set-semantically richer than A= da's mere public and private. > >=20 > > * e.g., element of, set-difference, union/conjunction, intersection/di= sjunction, not/converse, power-set >=20 > Set-theoretic operations have only limited interest. http://citeseerx.ist.psu.edu/viewdoc/download?doi=3D10.1.1.51.200&rep=3Drep= 1&type=3Dpdf I disagree. From 2 decades ago, Holzm=C3=BCller & Pl=C3=B6dereder seem to = find quite a fascinating use for one set-theoretic operation in particular:= union/conjunction as the basis for openmultimethods dispatched more like = PL/I generics (dispatched on subprograms by curated type) than Ada95/C++ si= ngle-dispatch OO (i.e., dispatched on types by curated subprogram). > There is a=20 > contradiction to type definition as a set of values and operations.=20 > Since operations cannot be deduced There is where you went wayward: =E2=80=A2introduced=E2=80=A2 overtly as p= er Holzm=C3=BCller & Pl=C3=B6dereder, not =E2=80=A2deduced=E2=80=A2. > from the domain set, there is little=20 > merit in producing the domain set of a specific form. > > It is easier for the compiler and the programmer to let the programmer=20 > define the domain set using a few built-in constructs, like arrays,=20 > records, tagged closure, which provide straightforward and efficient=20 > implementation. After all it will be in the end hidden in the private=20 > part of the ADT, following the programing practice of information hiding. >=20 > > *** not that that was necessarily a good thing per se, just a strawman/= starting-point demonstration of > > what is conceivable with compile-time set operations on types, subtypes= , class-trees, etc. >=20 > Types algebra, yes. Most important type operations Ada lacks are: >=20 > - ad-hoc supertypes, > - interface inheritance, > - full MI, > - full MD >=20 > --=20 > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de