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 10.107.47.7 with SMTP id j7mr16623755ioo.31.1520439181410; Wed, 07 Mar 2018 08:13:01 -0800 (PST) X-Received: by 10.157.41.184 with SMTP id n53mr1199028otb.11.1520439181311; Wed, 07 Mar 2018 08:13:01 -0800 (PST) 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!border1.nntp.dca1.giganews.com!nntp.giganews.com!r195no189147itc.0!news-out.google.com!a2ni1081ite.0!nntp.google.com!e10no347121itf.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 7 Mar 2018 08:13:01 -0800 (PST) In-Reply-To: <1520428274.2488.155.camel@obry.net> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=47.185.233.194; posting-account=zwxLlwoAAAChLBU7oraRzNDnqQYkYbpo NNTP-Posting-Host: 47.185.233.194 References: <896b83c6-83d4-4ffc-8c56-1481802ea8fd@googlegroups.com> <961c82e0-7d7e-48af-8751-916a3332ccc5@googlegroups.com> <1520428274.2488.155.camel@obry.net> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <48d8c845-589c-4018-9282-73f2b7b8b55b@googlegroups.com> Subject: Re: "functional" programming in Ada From: "Dan'l Miller" Injection-Date: Wed, 07 Mar 2018 16:13:01 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:50880 Date: 2018-03-07T08:13:01-08:00 List-Id: Pascal Obry wrote: > The =E2=80=A2spec=E2=80=A2 is what is =E2=80=A2=E2=80=A2exposed to other = units=E2=80=A2=E2=80=A2.=20 > > The =E2=80=A2body=E2=80=A2 is =E2=80=A2=E2=80=A2implementation=E2=80=A2= =E2=80=A2 details.=20 > > The separation is to me one of the most important point in Ada. The separation is important in =E2=80=A2modern Ada=E2=80=A2. Historically,= {Rational's, Sun Microsystems'} Verdix Ada Development System (VADS) compi= ler had a #-prefixed compile-time subset of Ada 1) that played some role as= a superduper extrapolation of what C or C++ use their preprocessor for and= 2) that played some role as a source-code-reflective compile-time code gen= erator =C3=A0 la OCaml's camlp4 does nowadays for OCaml. In this alternati= ve view, conversely: The =E2=80=A2spec=E2=80=A2 is what is the =E2=80=A2=E2=80=A2compiler=E2=80= =A2=E2=80=A2 is fully cognizant of at strictly compile-time. The =E2=80=A2body=E2=80=A2 is what only the =E2=80=A2=E2=80=A2hardware proc= essor=E2=80=A2=E2=80=A2 is fully cognizant of at run-time, most especially = execution-time accumulated-state behaviors based on one or more execution-t= ime inputs. (And there might exist people who say that Pascal Obry's and Dan'l Miller's= different wording there means exactly the same thing in the end. On even-= numbered days, I am one of those people. Conversely, on odd-numbered days,= I vociferously object!) > I think that all languages should have done that. Some people (e.g., the Boost community over in C++ world; the users of caml= p4 as a code generator in OCaml world; the a.app people in a prior Ada era;= to some degree, the aspect-oriented programming [AOP] people) believe that= compiled languages should have a compiler-internal compile-time =E2=80=98l= anguage=E2=80=99 in which poor-man's code generation/tweaking/trait-based-s= election or full-fledged code generation can be expressed as imperative and= /or functional code that the compiler invokes at compile-time to tailor/wea= ve the source code to be automatedly different than what a human being sub= mitted as input to the compiler. The burning question of our era is, =E2= =80=98who gets to author code: human or (multistage-)compiler or both=E2= =80=99? The school of thought that fully embraces this (with perhaps even = more than 2 stages: compile-time & run-time mentioned so far here) is mult= i-stage programming, where an app's source code may beget source-code gener= ation may beget source-code generation may beget ... may beget source-code = generation may beget compiled machine code. (In some variants, replace at = least some of those =E2=80=9Csource-code generation=E2=80=9D phrases with = =E2=80=98intermediate-representation generation=E2=80=99 phrases there.) Because C++, OCaml, AOP aspect weavers for various languages, and an earlie= r a.app era of Ada keep reinventing this wheel (differently), apparently th= ere exist people spanning several decades who =E2=80=9Cthink all languages = should have done that=E2=80=9D, where =E2=80=9Cthat=E2=80=9D is having a co= mpile-time language of some sort governing/tuning/tweaking/extending the co= mpiler's ability to generate machine code from human-authored/non-generated= source code. (To varying degrees, Seed7, 1970's era Alphard ,and the =E2= =80=98little languages=E2=80=99 subset of the OCaml community even go so fa= r as to say that the human-being author of an app should be able to declare= fresh novel syntax & semantics of the app's source code to the compiler, i= nstead of having, say, Ada's syntax & semantics chiseled in stone by a comm= ittee.) > It is an welcomed separation for software engineer.=20 The existence of the (highly impaired) C preprocessor, Ocaml's camlp4, VADS= 's a.app, AOP's aspect weavers, and C++'s Boost metatemplate programming al= l point that compile-time-invoked source code versus run-time-invoked sourc= e code in compilers is =E2=80=9Ca[] welcomed separation for [some] software= engineer[s].=E2=80=9D Rather than advocating all this, I am merely pointing out extant facts. I = am quite appalled at what this compile-time-code school of thought has done= to C++'s readability (and perhaps a few other software-architectural -abil= ities regarding C++) by sneaking it in the back door via their =E2=80=98dis= covery=E2=80=99 that C++'s templates are (just barely) Turing complete. Co= nversely, I am quite an admirer of full-fledged much-more-readable walk-in-= the-front-door multi-stage programming's 1 or more stages of source-code ge= neration then machine-code generation, preferably within the same language = with immense amounts of reflection and self-reflection-based analysis and g= rinding; OCaml world (and perhaps some of the Java-based aspect weavers of = AOP-of-Java) perform this much more admirably than, say, poor-man MTP in C+= + does. I mention all of this, so that Ada community is aware of slopes that they m= ight be standing on, so as to not make them slippery, as C++ did.