comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: "functional" programming in Ada
Date: Wed, 7 Mar 2018 21:34:53 -0600
Date: 2018-03-07T21:34:53-06:00	[thread overview]
Message-ID: <p7qb11$hi0$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: 1520428274.2488.155.camel@obry.net

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1785 bytes --]


"Pascal Obry" <pascal@obry.net> wrote in message 
news:1520428274.2488.155.camel@obry.net...
Le mercredi 07 mars 2018 à 02:52 -0800, Mehdi Saada a écrit :
>> Why not writing everything in the specs then ? Maybe the original
>> separation of specs and bodies is a mistake, in the light of recent
>> tools requirements.
>
>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. I think
>that all languages should have done that. It is an welcomed separation
>for software engineer.

Right. And note that the specification has always contained elements which 
are determined at runtime (that is, executed). For instance, even in Ada 83 
you could have a subtype like:

      subtype Dyn is Natural range 1 .. Some_Function;

and to properly export Dyn, one has to execute code.

The various contracts (preconditions, postconditions, predicates, etc.) all 
contain some executable code, and it is necessary for callers to be able to 
understand those contracts. Expression functions help in this, while the 
bulk of the implementation should remain in the body.

While the line separating the specification and the implementation is very 
important, it is also a blurry line (and always has been). Also note that 
the private part is effectively part of the body (that is, the 
implementation part), and that is where 95% of expression functions end up. 
So while they are physically in the source code of the specification, they 
still belong to the body. (The private part, after all, is a hack to ease 
implementation. Expression functions are similar in a way, although it is 
not the Ada implementation that they are intended to help.)

                                          Randy.



  parent reply	other threads:[~2018-03-08  3:34 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
2018-03-12  0:13         ` Robert I. Eachus
2018-03-08  3:34       ` Randy Brukardt [this message]
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