comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: ANN: Adare_net Ada network lib
Date: Mon, 27 Sep 2021 23:52:33 -0500	[thread overview]
Message-ID: <siu72j$tcr$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: b1650e4c-90c6-4c75-8ee0-d7760f573320n@googlegroups.com


"AdaMagica" <christ-usch.grein@t-online.de> wrote in message 
news:b1650e4c-90c6-4c75-8ee0-d7760f573320n@googlegroups.com...
>> I agree with you Nicolas, they should not be declared Pure. It makes the 
>> GNAT compiler
>> check for example that there are no global variables used in the packages 
>> but other than
>> that, they (I didn't check all the packages) are not Pure. The pragma 
>> Pure worked as
>> expected in Ada83 but the meaning and utility of it disappeared with the 
>> Ada95 standard.

>There is no pragma Pure in Ada 83.

Pragma Pure was an IMHO failed attempt to control/document access to 
globals. It has much too broad of a granularity to be very useful (I've 
never found anything that I could make Pure outside of language-defined 
things, and some of those cannot be implemented as Pure even though declared 
that way). Ada 2022 has aspect Global to do this properly, Global => null 
has many fewer holes than Pure.

Note however that one can always lie about any Ada semantics in interfacing 
code. But any such lies make your code erroneous, and while it might work on 
one compiler today, there's no guarentee that it will work anywhere else 
(including the next update of your usual compiler). See B.1(38.1/5):

  It is the programmer's responsibility to ensure that the use of 
interfacing aspects does
  not violate Ada semantics; otherwise, program execution is erroneous. For 
example,
  passing an object with mode in to imported code that modifies it causes 
erroneous
  execution. Similarly, calling an imported subprogram that is not pure from 
a pure
  package causes erroneous execution.

[The latter two sentences were added because programmers didn't seem to get 
what the first sentence means. We wanted that to be interpreted in the 
broadest possible way.]

                               Randy.


  parent reply	other threads:[~2021-09-28  4:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-05  3:54 ANN: Adare_net Ada network lib Daniel Norte Moraes
2021-09-17 21:04 ` DrPi
2021-09-22  8:47   ` Joakim Strandberg
2021-09-22  9:16     ` AdaMagica
2021-09-22 11:07       ` Joakim Strandberg
2021-09-27  4:32         ` Daniel Norte Moraes
2021-09-30 12:24           ` DrPi
2021-09-30 20:10             ` Daniel Norte Moraes
2021-10-01 17:33               ` DrPi
2021-10-01 19:11                 ` Simon Wright
2021-10-12 16:00                 ` Shark8
2021-12-30 21:15                 ` Daniel Norte Moraes
2021-10-12 15:49             ` Shark8
2021-10-12 19:44               ` Egil H H
2021-12-30 21:30                 ` Daniel Norte Moraes
2021-09-28  4:52       ` Randy Brukardt [this message]
2021-12-30 20:56         ` Daniel Norte Moraes
replies disabled

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