comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Ada syntax questions
Date: Sat, 19 Dec 2020 20:37:31 +0100	[thread overview]
Message-ID: <rrlkpn$13gp$1@gioia.aioe.org> (raw)
In-Reply-To: e5f1f9ee-d11a-44d8-b26d-61060039b587n@googlegroups.com

On 2020-12-19 19:40, Andreas ZEURCHER wrote:
> On Saturday, December 19, 2020 at 11:49:12 AM UTC-6, Dmitry A. Kazakov wrote:
>> On 2020-12-19 18:13, Andreas ZEURCHER wrote:
>>> On Saturday, December 19, 2020 at 6:40:28 AM UTC-6, Dmitry A. Kazakov wrote:
>>>> On 2020-12-19 12:50, DrPi wrote:

>> If contracts were indeed relevant to the syntax then functions without
>> contracted side effects must have been called using [] instead of ().
>>
>> No? Then it is not about the contracts.
> 
> As witnessed by your final sentence quoted below and multiple other replies along this thread, the key tactical advantage of Ada's usage parentheses for array indexing is to accomplish a switcheroo days, weeks, months, years, or decades later:  to substitute a function invocation later for what was formerly an array index.

Not substitute, but to provide whatever implementation necessary. In 
fact Ada is limited in terms of abstractions. There still exist things 
which cannot be implemented by user-defined subprograms. Ideally there 
should be none. Whatever syntax sugar, there should be always a 
possibility to back it by a user-provided primitive operation.

> But for people like DrPi who seek contractual assurance of FP-purity of (all?) invoked functions (and overt declaration of impurity of other functions),

If they are unsatisfied with the higher abstraction level of Ada, they 
can switch to lower-level languages where implementation details are 
exposed in syntax. The best we can do is to explain why such exposure is 
a bad idea.

[ Conceptually Ada has nothing to do with FP and I sincerely hope it 
never will. ]

> This 1970s faux pas in letting a silent slip-streamed switcheroo into the core contract-definition declaration mechanism of Ada (not comments! btw, tisk tisk) is merely some tarnish that an AdaNG (next-generation Ada) would fix: e.g., by mandating that all functions (and procedures?) shall be overtly declared & enforced to be pure or impure, which would then mean that only pure functions could substitute for array indexing is the ()-based switcheroo on which so many replies in this thread hang their hat.

This would be highly undesired. On the contrary impure array 
implementations are all OK to implement various heuristics and caching 
schemes on the container side. In fact, Ada moved in that direction 
already by providing crude user-defined array indexing. Clearly as 
hardware evolves towards parallel architectures with partitioned memory, 
low-level arrays will be less frequently exposed in interfaces. 
Comparing older and newer Ada code we can see that trend of moving away 
from plain arrays.

Furthermore, purity of implementation is not contract, per definition 
of. Purity is a non-functional requirement.

There is only few areas of interest for such:

1. Compile-time evaluation/initialization of static objects and constraints.

2. Optimization, especially in the cases fine grained parallelism.

In any case there is no reason to reflect that in the syntax, whatsoever.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2020-12-19 19:37 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-17 22:39 Ada syntax questions DrPi
2020-12-17 23:18 ` Gabriele Galeotti
2020-12-18  8:26 ` Jeffrey R. Carter
2020-12-18  9:18 ` Dmitry A. Kazakov
2020-12-18 16:55 ` Mart van de Wege
2020-12-18 17:38 ` Björn Lundin
2020-12-18 19:35 ` Niklas Holsti
2020-12-20 21:59   ` Keith Thompson
2020-12-22  1:04     ` Randy Brukardt
2020-12-22  8:00       ` Dmitry A. Kazakov
2020-12-23  1:23         ` Randy Brukardt
2020-12-23  8:59           ` Dmitry A. Kazakov
2020-12-24  4:06             ` Randy Brukardt
2020-12-24  9:37               ` Dmitry A. Kazakov
2020-12-22 13:48       ` AdaMagica
2020-12-20 21:59   ` Keith Thompson
2020-12-21  8:08     ` Dmitry A. Kazakov
2020-12-18 23:09 ` Stephen Leake
2020-12-19 11:50   ` DrPi
2020-12-19 12:40     ` Dmitry A. Kazakov
2020-12-19 17:13       ` Andreas ZEURCHER
2020-12-19 17:49         ` Dmitry A. Kazakov
2020-12-19 18:40           ` Andreas ZEURCHER
2020-12-19 19:37             ` Dmitry A. Kazakov [this message]
2020-12-19 22:11               ` Andreas ZEURCHER
2020-12-20  8:47                 ` Dmitry A. Kazakov
2020-12-20 16:53                   ` Andreas ZEURCHER
2020-12-22  0:58                     ` Randy Brukardt
2020-12-22  2:39                       ` Andreas ZEURCHER
2020-12-22 10:05                     ` Stéphane Rivière
2020-12-25  9:34                     ` G.B.
2020-12-19 17:01     ` AdaMagica
2020-12-19 21:51     ` Stephen Leake
2020-12-19 22:20       ` Andreas ZEURCHER
2020-12-20 14:10       ` DrPi
replies disabled

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