comp.lang.ada
 help / color / mirror / Atom feed
From: "Dan'l Miller" <optikos@verizon.net>
Subject: Re: "functional" programming in Ada
Date: Wed, 7 Mar 2018 08:13:01 -0800 (PST)
Date: 2018-03-07T08:13:01-08:00	[thread overview]
Message-ID: <48d8c845-589c-4018-9282-73f2b7b8b55b@googlegroups.com> (raw)
In-Reply-To: <1520428274.2488.155.camel@obry.net>

Pascal Obry wrote:
> The •spec• is what is ••exposed to other units••. 
>
> The •body• is ••implementation•• details. 
>
> The separation is to me one of the most important point in Ada.

The separation is important in •modern Ada•.  Historically, {Rational's, Sun Microsystems'} Verdix Ada Development System (VADS) compiler 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 generator à la OCaml's camlp4 does nowadays for OCaml.  In this alternative view, conversely:

The •spec• is what is the ••compiler•• is fully cognizant of at strictly compile-time.

The •body• is what only the ••hardware processor•• is fully cognizant of at run-time, most especially execution-time accumulated-state behaviors based on one or more execution-time 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 camlp4 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 ‘language’ in which poor-man's code generation/tweaking/trait-based-selection or full-fledged code generation can be expressed as imperative and/or functional code that the compiler invokes at compile-time to tailor/weave the source code to be automatedly different than what  a human being submitted as input to the compiler.  The burning question of our era is, ‘who gets to author code:  human or (multistage-)compiler or both’?  The school of thought that fully embraces this (with perhaps even more than 2 stages:  compile-time & run-time mentioned so far here) is multi-stage programming, where an app's source code may beget source-code generation 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 “source-code generation” phrases with ‘intermediate-representation generation’ phrases there.)

Because C++, OCaml, AOP aspect weavers for various languages, and an earlier a.app era of Ada keep reinventing this wheel (differently), apparently there exist people spanning several decades who “think all languages should have done that”, where “that” is having a compile-time language of some sort governing/tuning/tweaking/extending the compiler's ability to generate machine code from human-authored/non-generated source code.  (To varying degrees, Seed7, 1970's era Alphard ,and the ‘little languages’ subset of the OCaml community even go so far 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, instead of having, say, Ada's syntax & semantics chiseled in stone by a committee.)

> It is an welcomed separation for software engineer. 

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 all point that compile-time-invoked source code versus run-time-invoked source code in compilers is “a[] welcomed separation for [some] software engineer[s].”

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 -abilities regarding C++) by sneaking it in the back door via their ‘discovery’ that C++'s templates are (just barely) Turing complete.  Conversely, 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 generation then machine-code generation, preferably within the same language with immense amounts of reflection and self-reflection-based analysis and grinding; 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 might be standing on, so as to not make them slippery, as C++ did.


  parent reply	other threads:[~2018-03-07 16:13 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-06 11:34 "functional" programming in Ada Alejandro R. Mosteo
2018-03-06 13:09 ` Dmitry A. Kazakov
2018-03-06 14:35   ` Alejandro R. Mosteo
2018-03-06 15:08     ` Dmitry A. Kazakov
2018-03-06 16:00       ` Manuel Collado
2018-03-06 16:37         ` Dmitry A. Kazakov
2018-03-06 22:16           ` Manuel Collado
2018-03-07  8:41             ` Dmitry A. Kazakov
2018-03-07  4:46         ` Paul Rubin
2018-03-06 13:29 ` Mehdi Saada
2018-03-06 14:34   ` Alejandro R. Mosteo
2018-03-06 14:36     ` Mehdi Saada
2018-03-06 15:27       ` Alejandro R. Mosteo
2018-03-06 16:26       ` Jeffrey R. Carter
2018-03-06 20:17       ` Randy Brukardt
2018-03-07 14:30         ` Alejandro R. Mosteo
2018-03-06 15:01 ` Dan'l Miller
2018-03-06 15:25   ` Alejandro R. Mosteo
2018-03-07 10:07 ` Maciej Sobczak
2018-03-07 10:52   ` Mehdi Saada
2018-03-07 13:11     ` Pascal Obry
2018-03-07 13:53       ` Dmitry A. Kazakov
2018-03-07 16:13       ` Dan'l Miller [this message]
2018-03-12  0:13         ` Robert I. Eachus
2018-03-08  3:34       ` Randy Brukardt
2018-03-08  8:23         ` Dmitry A. Kazakov
2018-03-08 22:49           ` G. B.
2018-03-09  8:38             ` Dmitry A. Kazakov
2018-03-09  8:40           ` Simon Wright
2018-03-09 13:39             ` Dmitry A. Kazakov
2018-03-07 15:03   ` Alejandro R. Mosteo
2018-03-07 15:16     ` Alejandro R. Mosteo
2018-03-07 20:34     ` Robert A Duff
2018-03-07 22:47     ` Jeffrey R. Carter
2018-03-08  0:26     ` Shark8
2018-03-08  0:45     ` Paul Rubin
2018-03-08 11:07       ` Alejandro R. Mosteo
2018-03-08 18:24 ` G. B.
2018-03-09 14:41   ` Alejandro R. Mosteo
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox