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:b045:: with SMTP id b5-v6mr3754146itj.35.1532723911174; Fri, 27 Jul 2018 13:38:31 -0700 (PDT) X-Received: by 2002:aca:75c9:: with SMTP id q192-v6mr163328oic.3.1532723911005; Fri, 27 Jul 2018 13:38:31 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.unit0.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.am4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!d7-v6no2111869itj.0!news-out.google.com!k71-v6ni2315itk.0!nntp.google.com!d7-v6no2111865itj.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 27 Jul 2018 13:38:30 -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: <99a9127d-1024-4690-aa1d-8b3026a0f57d@googlegroups.com> Subject: Re: Ada Distilled by Richard Riehle From: "Dan'l Miller" Injection-Date: Fri, 27 Jul 2018 20:38:31 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 7463 X-Received-Body-CRC: 2191518855 Xref: reader02.eternal-september.org comp.lang.ada:53987 Date: 2018-07-27T13:38:30-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. I wasn't asking what are Ada's type differences vis a vis the other languag= es. I was asking: how does Ada have a focus on =E2=80=A2sets of=E2=80=A2 = types that other languages lack or don't bring forth as fully as a focus on= =E2=80=A2sets=E2=80=A2. > > 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. There is a=20 > contradiction to type definition as a set of values and operations.=20 > Since operations cannot be deduced from the domain set, there is little= =20 > merit in producing the domain set of a specific form. >=20 > 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, {Objective-C, C#, Swift}-esque ad-hoc supertype extension mechanism seems l= ike it would violate some fundamental principles/axioms of Ada: guaranteei= ng at compile-time that a dispatch to an object will succeed. (Although by= my observation of error messages that I receive, it seems as though C#'s R= oslyn compiler can look widely across multiple compilation units to assure = this guarantee at least under certain conditions, but I am unsure that Rosl= yn covers =E2=80=A2all=E2=80=A2 the cases/loopholes.) > - interface inheritance, What portion of interface inheritance is Ada lacking? Are you saying (agai= n) that interface inheritance requires tagged records and that you would li= ke interface inheritance for untagged types? > - full MI, Ewwwwwww. No, as shown by the debacle of C++'s multiple inheritance, full = multiple inheritance is not useful beyond mixin-an-interface inheritance wh= ich Ada already has for tagged records. > - full MD Full multiple dispatch was added experimentally back in the day for Ada as = part of the Ada9X exploratory contracts, by SRI iIRC.