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:a6b:224a:: with SMTP id i71-v6mr8917494ioi.8.1529518695117; Wed, 20 Jun 2018 11:18:15 -0700 (PDT) X-Received: by 2002:aca:d60f:: with SMTP id n15-v6mr1026178oig.6.1529518694926; Wed, 20 Jun 2018 11:18:14 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.linkpendium.com!news.linkpendium.com!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!d7-v6no1330795itj.0!news-out.google.com!c20-v6ni704itc.0!nntp.google.com!u78-v6no1359429itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 20 Jun 2018 11:18:14 -0700 (PDT) In-Reply-To: <7cb22c58-3009-47f0-8fe7-62f3cd61785d@googlegroups.com> 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: <584564c2-9f64-4965-b045-535cdaf899c0@googlegroups.com> <7cb22c58-3009-47f0-8fe7-62f3cd61785d@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Why are Ada compilers difficult to write ? From: "Dan'l Miller" Injection-Date: Wed, 20 Jun 2018 18:18:15 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:53210 Date: 2018-06-20T11:18:14-07:00 List-Id: On Wednesday, June 20, 2018 at 12:55:02 PM UTC-5, Dan'l Miller wrote: > On Wednesday, June 20, 2018 at 10:54:22 AM UTC-5, Jeffrey R. Carter wrote= : > > On 06/19/2018 11:33 PM, Vincent wrote: > > >=20 > > > I have often heard that Ada compilers where expensive because they ar= e very difficult to write, compared to Pascal or C ones. So my question is = : what in the Ada language poses problem to a compiler ? What are the chall= enges ? Where can I find documentation about that ? > >=20 > > Compared to single-file, sequential languages like Pascal or C, Ada has > >=20 > > * Packages > > * Tasks >=20 > So does C++17. >=20 > > * Protected types and objects >=20 > So does C++98. >=20 > > * Generics >=20 > So does C++ (in the GNAT=C2=A0sense of not reusing object code among the = various formal type parameters), but this line item should be focused on th= e true complexity:=C2=A0=C2=A0generics with elaborate constraints on formal= -arguments and renaming, which C++ calls concepts and concept-maps, respect= ively, which are the perennial rejected feature in the standardization comm= ittee, which keeps finding blocking problems in Stroustrup's concept/concep= t-map proposals in all of {C++11, C++14, C++17, perhaps C++20 too}. >=20 > > * Tagged types >=20 > So does C++ since the early 1980s when it was named C-with-Classes. >=20 > > * Interfaces >=20 > So does C++=C2=A0as Taligent-style mixin multiple inheritance, although t= o be fair, this is one of the trouble areas for adding concepts/concept-map= s to C++, AIUI. >=20 > > * Discriminants > > * Elaboration > > * Finalization >=20 > So does C++ since the early 1980s back when it was named C-with-Classes. >=20 > > * Overloading >=20 > So does C++ since the 1980s. >=20 > > * Separate compilation with cross-unit checking Oh, I forgot: Separate compilation of templates has been attempted twice in C++: 1)=C2=A0template export:=C2=A0=C2=A0only one compiler (Edison Design Group)= =C2=A0ever got it working, then fairly immediately deprecated it. https://= stackoverflow.com/questions/5416872/using-export-keyword-with-templates 2)=C2=A0template modules: still a work-in-progress. The jury is still out= . Apparently this is truly an outstanding engineering-achievement accomplishm= ent of mastery of difficulty for Ada compilers, because C++=C2=A0has been t= rying for over a decade to replicate Ada's accomplishment. Template export= failed miserably. Template modules are still not stable enough to be in a= C++=C2=A0programmer's everyday repertoire. > > * Indefinite types > >=20 > > and no doubt others I haven't thought of, so hardly any difference at a= ll. >=20 > *=C2=A0Optionally-controlled types >=20 > So does C++, although historically this optionality was crude. In C++11,= C++14, and C++17, C++=C2=A0finally seems to match Ada's ability to overtly= fine-tune which types have constructors and destructors. >=20 > *=C2=A0Exceptions, especially exceptions for finalizing controlled types = by unwinding the call-stack across multiple threads-of-execution. >=20 > So does C++. C++'s exceptions are even more difficult to implement becau= se they are arbitrary user-code data structures. Ada's exceptions are fixe= d records without any user-domain arbitrary addition of fields or propertie= s or aspects. >=20 > *=C2=A0Record representation specification >=20 > *=C2=A0Moderately generous reflection via 'Tags >=20 > So does Java and Objective-C runtime-based object models, much more gener= ous amount of reflection, in fact. >=20 > * Numerous aspects (historically standardized as pragmas) >=20 > So does C++11, C++14, and C++17. >=20 > *=C2=A0Far fewer topics (than other languages) dismissed as undefined beh= aviors or illicit program >=20 > *=C2=A0Far more topics (than other languages) that a compiler must divulg= e as well-known limitations >=20 > *=C2=A0Case insensitivity in a predominantly case-sensitive Unix/Linux wo= rld >=20 > *=C2=A0A section of the Ada _LRM_ standard commonly called the "heart of = darkness" which supposedly only a handful of people on the planet grok >=20 > C++ has had a few a these (e.g., Koenig lookup) where even the vast major= ity of the people on the standards committee were almost 100% clueless abou= t. Stroustrup is claiming that more ghosts in the machine are lurking that= only a few people partially understand at all: https://www.theregister.co= .uk/2018/06/18/bjarne_stroustrup_c_plus_plus >=20 > *=C2=A0An _LRM_ standards document both that is quite complex/precise in = intent but that is written in prose (instead of formal methods or instead o= f even system-engineering "shall" requirements)=C2=A0that by ARG's own admi= ssion lacks a sufficiently exhaustive ISO-required glossary of jargon terms= that are overtly inventoried as not utilizing the evoked English dictionar= y commonfolk definitions >=20 > *=C2=A0Immense amounts of exceptionalism-based lack of orthogonality: yo= u can do this in the context of that, but you cannot do this in the context= of whosiewhatisit, but conversely still you can do a restricted subset of = this in the context of thingamajig. (Restricted/prohibited in a little pro= se here and a little prose there, scattered hither and yon in the _LRM_, of= course. GNAT's internal documentation=C2=A0even discusses this briefly as= "numerous passes" that are "in [ascending] chapter order of the _LRM_" to = counteract the scattered hither and yon state of affairs. These numerous p= asses transform the raw syntactic AST into an evermore semantically adorned= Ada IR in the GNAT=C2=A0frontend, prior to GIGI.) >=20 > * (Over-)reliance on the optimizing stages to drastically improve perform= ance based on logical deductions and context analysis, but often not overtl= y specifying in the _LRM_=C2=A0the precise set of contextual inputs and ste= ps of logical deduction to discover that opportunity for optimization >=20 > So does C++, perhaps ever more so nowadays. >=20 > Conversely, C++ has so much house-of-cards undefined behavior shakiness t= hat every language feature must tip-toe extraordinarily gently around, that= I am actually surprised that multithreading and move-semantics and futures= and ... and ... and ... new features aren't crashing &=C2=A0burning quite = often in realworld programs, as this is in the context of that. >=20 > So when comparing modern Ada to modern C++, it is not clear at all which = one is more complex of a compiler to implement from scratch. The real diff= erence is that Apple's deep pockets funded the development of Clang from sc= ratch. Since the disappearance of the AJPO, Ada has no such deep-pockets f= under. I am pretty sure that "lack of deep pockets" is actually the best a= nswer to OP's question, not something technical or theoretical.