Hi!
I and a friend created an Ada network lib where,
from the begining, we tried very hard to make It a Ada Pure.
From the examples dir, the lib worked as expected (in gcc-10.2 gcc-11.2 and gcc-12).
To our surprise, what most caught the attention of the group's friends was the fact that the lib was Ada Pure and if that was correct.
For this reason, if really 'is' pure, not pure, preelaborate or what (?), pleeeeeeaaase, we ask the group's Ada Language Lawyers to help analyze and suggest modifications if necessary.
link: https://gitlab.com/daresoft/network/adare_net/-/tree/202x
for Ada version use 2012 and or 202x.
Best Wishes and Happy New Year,
Dani.
For this reason, if really 'is' pure, not pure, preelaborate or what (?), pleeeeeeaaase, we ask the group's Ada Language Lawyers to help analyze and suggest modifications if necessary.
On Friday, December 31, 2021 at 11:13:33 AM UTC-5, daniel...@gmail.com wrote:Pure, on the other hand the C functions can violate those "purity rules" all they want, which might be misleading to users expecting otherwise. You don't use 'Unchecked_Access either, but obviously that doesn't mean the C functions are somehow prevented
Hi!
I and a friend created an Ada network lib where,
from the begining, we tried very hard to make It a Ada Pure.
From the examples dir, the lib worked as expected (in gcc-10.2 gcc-11.2 and gcc-12).
To our surprise, what most caught the attention of the group's friends was the fact that the lib was Ada Pure and if that was correct.
For this reason, if really 'is' pure, not pure, preelaborate or what (?), pleeeeeeaaase, we ask the group's Ada Language Lawyers to help analyze and suggest modifications if necessary.
link: https://gitlab.com/daresoft/network/adare_net/-/tree/202x
for Ada version use 2012 and or 202x.
Best Wishes and Happy New Year,It seems to be mostly just a thin binding to a bunch of C functions, so the applicability of any Ada feature is mostly a moot point. The Ada compiler has no control or visibility into the C domain, so while on the one hand your packages are technically
Dani.
-sb
On Friday, December 31, 2021 at 5:13:33 PM UTC+1, daniel...@gmail.com wrote:
For this reason, if really 'is' pure, not pure, preelaborate or what (?), pleeeeeeaaase, we ask the group's Ada Language Lawyers to help analyze and suggest modifications if necessary.I recommend reading this: https://stackoverflow.com/questions/19353228/when-to-use-pragma-pure-preelaborate
If your units are declared as Pure, the compiler considers that they have no side effect and can decided to call the sub-programs only once and cache the result, or not even call the sub-program if the result is not used after.
Em terça-feira, 4 de janeiro de 2022 às 10:52:42 UTC-3, Fabien Chouteau >escreveu:
On Friday, December 31, 2021 at 5:13:33 PM UTC+1, daniel...@gmail.com
wrote:
For this reason, if really 'is' pure, not pure, preelaborate or whatI recommend reading this:
(?), pleeeeeeaaase, we ask the group's Ada Language Lawyers to help
analyze and suggest modifications if necessary.
https://stackoverflow.com/questions/19353228/when-to-use-pragma-pure-preelaborate
If your units are declared as Pure, the compiler considers that they have
no side effect and can decided to call the sub-programs only once and
cache the result, or not even call the sub-program if the result is not
used after.
Thanks!
I read the post and believe that because most variables are either streamed >or aliased and imported, lib works as it should.
However, there is still the possible problem of omitting the same
subprograms with the same parameters (by compiler), although in the tests >this did not happen, would replacing aspect 'pure' by 'preelaborate' solve >this possible problem?
"Daniel Norte Moraes" <daniel...@gmail.com> wrote in message news:378bc69a-8388-4daf...@googlegroups.com...
Em terça-feira, 4 de janeiro de 2022 às 10:52:42 UTC-3, Fabien Chouteau >escreveu:
On Friday, December 31, 2021 at 5:13:33 PM UTC+1, daniel...@gmail.com
wrote:
For this reason, if really 'is' pure, not pure, preelaborate or whatI recommend reading this:
(?), pleeeeeeaaase, we ask the group's Ada Language Lawyers to help
analyze and suggest modifications if necessary.
https://stackoverflow.com/questions/19353228/when-to-use-pragma-pure-preelaborate
If your units are declared as Pure, the compiler considers that they have >> no side effect and can decided to call the sub-programs only once and
cache the result, or not even call the sub-program if the result is not >> used after.
Thanks!Yes. The permission to omit calls only applies to Pure (see 10.2.1(18/3)). http://www.ada-auth.org/standards/2xaarm/html/AA-10-2-1.html#p18. (I gave a reference to the Ada 2022 AARM, but this rule hasn't changed in spirit since it was introduced in Ada 95.)
I read the post and believe that because most variables are either streamed >or aliased and imported, lib works as it should.
However, there is still the possible problem of omitting the same >subprograms with the same parameters (by compiler), although in the tests >this did not happen, would replacing aspect 'pure' by 'preelaborate' solve >this possible problem?
Randy.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 335 |
Nodes: | 16 (2 / 14) |
Uptime: | 150:16:48 |
Calls: | 7,411 |
Calls today: | 1 |
Files: | 12,670 |
Messages: | 5,613,277 |