comp.lang.ada
 help / color / mirror / Atom feed
* ANN: Adare_net Ada network lib
@ 2021-09-05  3:54 Daniel Norte Moraes
  2021-09-17 21:04 ` DrPi
  0 siblings, 1 reply; 17+ messages in thread
From: Daniel Norte Moraes @ 2021-09-05  3:54 UTC (permalink / raw)


Hi All! :-)

Adare_net is a small, portable and easy to use Ada network lib.
It supports ipv4 ipv6 udp and tcp, and can 'listen' with ipv6, too.

The powerfull buffer feature can support all Ada types,
and with a more refined treatment, you can use endian proof records and
unconstrained arrays.

From now, tested and working:
AMD64 :
mswindows 7 sp1 64bits
and ubuntu Hirsute 64bits

Thanks and Enjoy!!

https://gitlab.com/daresoft/network/adare_net

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ANN: Adare_net Ada network lib
  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
  0 siblings, 1 reply; 17+ messages in thread
From: DrPi @ 2021-09-17 21:04 UTC (permalink / raw)


Hi,

Le 05/09/2021 à 05:54, Daniel Norte Moraes a écrit :
> Hi All! :-)
> 
> Adare_net is a small, portable and easy to use Ada network lib.
> It supports ipv4 ipv6 udp and tcp, and can 'listen' with ipv6, too.
> 
> The powerfull buffer feature can support all Ada types,
> and with a more refined treatment, you can use endian proof records and
> unconstrained arrays.
> 
>  From now, tested and working:
> AMD64 :
> mswindows 7 sp1 64bits
> and ubuntu Hirsute 64bits
> 
> Thanks and Enjoy!!
> 
> https://gitlab.com/daresoft/network/adare_net
> 

I had a quick look at the top level source code. I'm surprised all 
packages are declared with "pure" aspect.
 From what I understand of the "pure" aspect, these packages are not pure.
Am I wrong ?

Regards,
Nicolas

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ANN: Adare_net Ada network lib
  2021-09-17 21:04 ` DrPi
@ 2021-09-22  8:47   ` Joakim Strandberg
  2021-09-22  9:16     ` AdaMagica
  0 siblings, 1 reply; 17+ messages in thread
From: Joakim Strandberg @ 2021-09-22  8:47 UTC (permalink / raw)


> I had a quick look at the top level source code. I'm surprised all 
> packages are declared with "pure" aspect. 
> From what I understand of the "pure" aspect, these packages are not pure. 
> Am I wrong ? 
> 
> Regards, 
> Nicolas

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. It is possible in Ada95 to declare a package as Pure and then import C-functions that can do anything. It is also possible in Ada95 to circumvent the meaning of pragma Pure or the Pure aspect by taking advantage of dynamic dispatch. If there is any use of a tagged type inside a package or there is some C-function that is imported, the package should not be labeled as Pure. It should be possible to develop a libadalang- or ASIS based application to check for this. Well, this is a small issue since it is easy to remove the Pure aspects. In any case, thanks to the author for writing adare_net and sharing it with the World!

Best regards,
Joakim

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ANN: Adare_net Ada network lib
  2021-09-22  8:47   ` Joakim Strandberg
@ 2021-09-22  9:16     ` AdaMagica
  2021-09-22 11:07       ` Joakim Strandberg
  2021-09-28  4:52       ` Randy Brukardt
  0 siblings, 2 replies; 17+ messages in thread
From: AdaMagica @ 2021-09-22  9:16 UTC (permalink / raw)


> 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.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ANN: Adare_net Ada network lib
  2021-09-22  9:16     ` AdaMagica
@ 2021-09-22 11:07       ` Joakim Strandberg
  2021-09-27  4:32         ` Daniel Norte Moraes
  2021-09-28  4:52       ` Randy Brukardt
  1 sibling, 1 reply; 17+ messages in thread
From: Joakim Strandberg @ 2021-09-22 11:07 UTC (permalink / raw)


onsdag 22 september 2021 kl. 11:16:13 UTC+2 skrev AdaMagica:
> > 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.

Thanks for clearing that up AdaMagica, I wasn't aware.

Best regards,
Joakim

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ANN: Adare_net Ada network lib
  2021-09-22 11:07       ` Joakim Strandberg
@ 2021-09-27  4:32         ` Daniel Norte Moraes
  2021-09-30 12:24           ` DrPi
  0 siblings, 1 reply; 17+ messages in thread
From: Daniel Norte Moraes @ 2021-09-27  4:32 UTC (permalink / raw)


Em quarta-feira, 22 de setembro de 2021 às 08:07:06 UTC-3, joak...@kth.se escreveu:
> onsdag 22 september 2021 kl. 11:16:13 UTC+2 skrev AdaMagica: 
> > > 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.
> Thanks for clearing that up AdaMagica, I wasn't aware. 
> 
> Best regards, 
> Joakim

Really? They _are_ Pure.
I used linters extensively to result in this. one of these linters made hard use o gnat and gprbuild as his backend.
Remember this is target Ada 2012 (update 2016) and beyond => there is 
no guarantee of operation for Ada versions earlier than Ada2012.

for now Adare_Net support:
MSwindows and Linux.

was tested in:
Mswindows => starting amd64 windows seven sp1 + msys2 gcc-10.3 gnat-10.3 gprbuild-2021
Linux => amd64 gcc-11.1+ gnat-11.1+ gprbuild-2021.

1o.) We need as many volunteers as possible to testing Adare_Net on as many
 operating systems as possible and reporting his/her result to us. 
 currently linux and mswindows are the targets.

Very Very Very Thanks! 
Enjoy!!!




^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ANN: Adare_net Ada network lib
  2021-09-22  9:16     ` AdaMagica
  2021-09-22 11:07       ` Joakim Strandberg
@ 2021-09-28  4:52       ` Randy Brukardt
  2021-12-30 20:56         ` Daniel Norte Moraes
  1 sibling, 1 reply; 17+ messages in thread
From: Randy Brukardt @ 2021-09-28  4:52 UTC (permalink / raw)



"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.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ANN: Adare_net Ada network lib
  2021-09-27  4:32         ` Daniel Norte Moraes
@ 2021-09-30 12:24           ` DrPi
  2021-09-30 20:10             ` Daniel Norte Moraes
  2021-10-12 15:49             ` Shark8
  0 siblings, 2 replies; 17+ messages in thread
From: DrPi @ 2021-09-30 12:24 UTC (permalink / raw)


Le 27/09/2021 à 06:32, Daniel Norte Moraes a écrit :
> Em quarta-feira, 22 de setembro de 2021 às 08:07:06 UTC-3, joak...@kth.se escreveu:
>> onsdag 22 september 2021 kl. 11:16:13 UTC+2 skrev AdaMagica:
>>>> 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.
>> Thanks for clearing that up AdaMagica, I wasn't aware.
>>
>> Best regards,
>> Joakim
> 
> Really? They _are_ Pure.
> I used linters extensively to result in this. one of these linters made hard use o gnat and gprbuild as his backend.
> Remember this is target Ada 2012 (update 2016) and beyond => there is
> no guarantee of operation for Ada versions earlier than Ada2012.

In a Pure package, shouldn't the subprograms also be Pure ?

> 
> for now Adare_Net support:
> MSwindows and Linux.
> 
> was tested in:
> Mswindows => starting amd64 windows seven sp1 + msys2 gcc-10.3 gnat-10.3 gprbuild-2021
> Linux => amd64 gcc-11.1+ gnat-11.1+ gprbuild-2021.
> 
> 1o.) We need as many volunteers as possible to testing Adare_Net on as many
>   operating systems as possible and reporting his/her result to us.
>   currently linux and mswindows are the targets.
> 
> Very Very Very Thanks!
> Enjoy!!!
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ANN: Adare_net Ada network lib
  2021-09-30 12:24           ` DrPi
@ 2021-09-30 20:10             ` Daniel Norte Moraes
  2021-10-01 17:33               ` DrPi
  2021-10-12 15:49             ` Shark8
  1 sibling, 1 reply; 17+ messages in thread
From: Daniel Norte Moraes @ 2021-09-30 20:10 UTC (permalink / raw)


Em quinta-feira, 30 de setembro de 2021 às 09:24:34 UTC-3, DrPi escreveu:
> Le 27/09/2021 à 06:32, Daniel Norte Moraes a écrit : 
> > Em quarta-feira, 22 de setembro de 2021 às 08:07:06 UTC-3, joak...@kth.se escreveu: 
> >> onsdag 22 september 2021 kl. 11:16:13 UTC+2 skrev AdaMagica: 
> >>>> 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. 
> >> Thanks for clearing that up AdaMagica, I wasn't aware. 
> >> 
> >> Best regards, 
> >> Joakim 
> > 
> > Really? They _are_ Pure. 
> > I used linters extensively to result in this. one of these linters made hard use o gnat and gprbuild as his backend. 
> > Remember this is target Ada 2012 (update 2016) and beyond => there is 
> > no guarantee of operation for Ada versions earlier than Ada2012.
> In a Pure package, shouldn't the subprograms also be Pure ?
> > 
> > for now Adare_Net support: 
> > MSwindows and Linux. 
> > 
> > was tested in: 
> > Mswindows => starting amd64 windows seven sp1 + msys2 gcc-10.3 gnat-10.3 gprbuild-2021 
> > Linux => amd64 gcc-11.1+ gnat-11.1+ gprbuild-2021. 
> > 
> > 1o.) We need as many volunteers as possible to testing Adare_Net on as many 
> > operating systems as possible and reporting his/her result to us. 
> > currently linux and mswindows are the targets. 
> > 
> > Very Very Very Thanks! 
> > Enjoy!!! 
> > 
> > 
> > 
> >

Well, :-)

Why ?
The functions dont are pure ? why?

Maybe we need fix the ARM 2012+

The ARM2012 allowed it. gprbuild and gnat just follow ARM :-).

To made things as a lib be almost all pure (or yet preelaborate) there are a hard and 
time consuming way to study and test. This fact is itself the main motive for almost all libs and apps ignore Ada categorizations.

Then, no one yet say if the lib work... only about pure... why? we need more than a 'freestyle' opinions.

For your use, just fork and make bether (ah and remove all Ada Categorizations :-)

====X=====

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ANN: Adare_net Ada network lib
  2021-09-30 20:10             ` Daniel Norte Moraes
@ 2021-10-01 17:33               ` DrPi
  2021-10-01 19:11                 ` Simon Wright
                                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: DrPi @ 2021-10-01 17:33 UTC (permalink / raw)


Le 30/09/2021 à 22:10, Daniel Norte Moraes a écrit :
> Em quinta-feira, 30 de setembro de 2021 às 09:24:34 UTC-3, DrPi escreveu:
>> Le 27/09/2021 à 06:32, Daniel Norte Moraes a écrit :
>>> Em quarta-feira, 22 de setembro de 2021 às 08:07:06 UTC-3, joak...@kth.se escreveu:
>>>> onsdag 22 september 2021 kl. 11:16:13 UTC+2 skrev AdaMagica:
>>>>>> 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.
>>>> Thanks for clearing that up AdaMagica, I wasn't aware.
>>>>
>>>> Best regards,
>>>> Joakim
>>>
>>> Really? They _are_ Pure.
>>> I used linters extensively to result in this. one of these linters made hard use o gnat and gprbuild as his backend.
>>> Remember this is target Ada 2012 (update 2016) and beyond => there is
>>> no guarantee of operation for Ada versions earlier than Ada2012.
>> In a Pure package, shouldn't the subprograms also be Pure ?
>>>
>>> for now Adare_Net support:
>>> MSwindows and Linux.
>>>
>>> was tested in:
>>> Mswindows => starting amd64 windows seven sp1 + msys2 gcc-10.3 gnat-10.3 gprbuild-2021
>>> Linux => amd64 gcc-11.1+ gnat-11.1+ gprbuild-2021.
>>>
>>> 1o.) We need as many volunteers as possible to testing Adare_Net on as many
>>> operating systems as possible and reporting his/her result to us.
>>> currently linux and mswindows are the targets.
>>>
>>> Very Very Very Thanks!
>>> Enjoy!!!
>>>
>>>
>>>
>>>
> 
> Well, :-)
> 
> Why ?
> The functions dont are pure ? why?
> 
A subprogram returning content read from the network can't be pure. Or 
there is something I have not understood about the Pure aspect.

> Maybe we need fix the ARM 2012+
> 
> The ARM2012 allowed it. gprbuild and gnat just follow ARM :-).
> 
> To made things as a lib be almost all pure (or yet preelaborate) there are a hard and
> time consuming way to study and test. This fact is itself the main motive for almost all libs and apps ignore Ada categorizations.
> 
> Then, no one yet say if the lib work... only about pure... why? we need more than a 'freestyle' opinions.
> 
My intent is to try Adare_Net. So I started by taking a look at the 
sources and the first thing I noticed was the Pure aspect of the 
packages. As I'm far from a Ada expert, and I like to understand things, 
I asked here about it.

Is there a documentation somewhere ?

> For your use, just fork and make bether (ah and remove all Ada Categorizations :-)
> 
> ====X=====
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ANN: Adare_net Ada network lib
  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
  2 siblings, 0 replies; 17+ messages in thread
From: Simon Wright @ 2021-10-01 19:11 UTC (permalink / raw)


DrPi <314@drpi.fr> writes:

> A subprogram returning content read from the network can't be pure. Or
> there is something I have not understood about the Pure aspect.

ARM 10.1.1(18)[1] says

   "[...] the implementation may omit a call on such a subprogram and
   simply reuse the results produced by an earlier call on the same
   subprogram, provided that [...]. This permission applies even if the
   subprogram produces other side effects when called."

[1] http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-10-2-1.html#p18

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ANN: Adare_net Ada network lib
  2021-09-30 12:24           ` DrPi
  2021-09-30 20:10             ` Daniel Norte Moraes
@ 2021-10-12 15:49             ` Shark8
  2021-10-12 19:44               ` Egil H H
  1 sibling, 1 reply; 17+ messages in thread
From: Shark8 @ 2021-10-12 15:49 UTC (permalink / raw)


On Thursday, September 30, 2021 at 6:24:34 AM UTC-6, DrPi wrote:
> Le 27/09/2021 à 06:32, Daniel Norte Moraes a écrit : 
> > Em quarta-feira, 22 de setembro de 2021 às 08:07:06 UTC-3, joak... 
> >> onsdag 22 september 2021 kl. 11:16:13 UTC+2 skrev AdaMagica: 
> >>>> 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. 
> >> Thanks for clearing that up AdaMagica, I wasn't aware. 
> >> 
> >> Best regards, 
> >> Joakim 
> > 
> > Really? They _are_ Pure. 
> > I used linters extensively to result in this. one of these linters made hard use o gnat and gprbuild as his backend. 
> > Remember this is target Ada 2012 (update 2016) and beyond => there is 
> > no guarantee of operation for Ada versions earlier than Ada2012.
> In a Pure package, shouldn't the subprograms also be Pure ?
Yes...ish.
As mentioned upthread, you can lie about there being no internal state... and this can still be "interfacially" pure; consider a FIBONACCI function which is memoized (Function F(N: Positive) return Positive) -- internally it has the memo to look up F(N), which is obviously state, but externally any F(X) will return the same value given the same inputs. / Perhaps we should allow aspect PURE on subprograms, as well as introduce an aspect STATIC [having (user-defined) static-functions would, in particular, allow some nice "macro-lite" functionality].

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ANN: Adare_net Ada network lib
  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
  2 siblings, 0 replies; 17+ messages in thread
From: Shark8 @ 2021-10-12 16:00 UTC (permalink / raw)


On Friday, October 1, 2021 at 11:33:45 AM UTC-6, DrPi wrote:
>
> My intent is to try Adare_Net. So I started by taking a look at the 
> sources and the first thing I noticed was the Pure aspect of the 
> packages. As I'm far from a Ada expert, and I like to understand things, 
> I asked here about it. 
> 
> Is there a documentation somewhere ?
The simple explanation of Pure is that it means there is no internal-state in the package; as a consequence, (1) a value-returning call with the same parameters can be treated as idempotent and therefore can be replicated across calls; and (2) in the Distributed Systems Annex, we can replicate this package across partitions w/o worrying about synchronization precisely because there is no internal state.

So, "ideologically" having a networking library marked "pure" is not _necessarily_ a wrong thing -- though treating such calls as idempotent certainly would be -- and perhaps that is a point where some refinement could be made; perhaps allowing subprograms to be marked aspect VOLATILE to indicate that they are not idempotent or some such.

> > For your use, just fork and make bether (ah and remove all Ada Categorizations :-) 
The categorizations *are* useful, as shown above... though overloading them with other properties, or rather having so coarse a granularity limits that.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ANN: Adare_net Ada network lib
  2021-10-12 15:49             ` Shark8
@ 2021-10-12 19:44               ` Egil H H
  2021-12-30 21:30                 ` Daniel Norte Moraes
  0 siblings, 1 reply; 17+ messages in thread
From: Egil H H @ 2021-10-12 19:44 UTC (permalink / raw)


On Tuesday, October 12, 2021 at 5:49:58 PM UTC+2, Shark8 wrote:
> On Thursday, September 30, 2021 at 6:24:34 AM UTC-6, DrPi wrote: 
> > Le 27/09/2021 à 06:32, Daniel Norte Moraes a écrit : 
> > > Em quarta-feira, 22 de setembro de 2021 às 08:07:06 UTC-3, joak...
> > >> onsdag 22 september 2021 kl. 11:16:13 UTC+2 skrev AdaMagica: 
> > >>>> 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. 
> > >> Thanks for clearing that up AdaMagica, I wasn't aware. 
> > >> 
> > >> Best regards, 
> > >> Joakim 
> > > 
> > > Really? They _are_ Pure. 
> > > I used linters extensively to result in this. one of these linters made hard use o gnat and gprbuild as his backend. 
> > > Remember this is target Ada 2012 (update 2016) and beyond => there is 
> > > no guarantee of operation for Ada versions earlier than Ada2012. 
> > In a Pure package, shouldn't the subprograms also be Pure ?
> Yes...ish. 
> As mentioned upthread, you can lie about there being no internal state... and this can still be "interfacially" pure; consider a FIBONACCI function which is memoized (Function F(N: Positive) return Positive) -- internally it has the memo to look up F(N), which is obviously state, but externally any F(X) will return the same value given the same inputs. / Perhaps we should allow aspect PURE on subprograms, as well as introduce an aspect STATIC [having (user-defined) static-functions would, in particular, allow some nice "macro-lite" functionality].

Well, aspect Static for expression functions is coming...
http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai12s/ai12-0075-1.txt?rev=1.15
http://ada-auth.org/standards/2xrm/html/RM-4-9.html
http://ada-auth.org/standards/2xrm/html/RM-6-8.html


-- 
~egilhh

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ANN: Adare_net Ada network lib
  2021-09-28  4:52       ` Randy Brukardt
@ 2021-12-30 20:56         ` Daniel Norte Moraes
  0 siblings, 0 replies; 17+ messages in thread
From: Daniel Norte Moraes @ 2021-12-30 20:56 UTC (permalink / raw)


Em terça-feira, 28 de setembro de 2021 às 01:52:37 UTC-3, Randy Brukardt escreveu:
> "AdaMagica" <christ-u...@t-online.de> wrote in message 
> news:b1650e4c-90c6-4c75...@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.

We apologize for the delay in responding. I (daniel) was expecting the 'static aspect' to have
  more support (I gotted this suggestion, and thanks to you who suggested it).
With the development release of gnat-12 I'll try to answer all the questions and make all the suggested
 changes that make sense.

Really Randy, I'm aware about this. 
I´ll try answer in order:

1) var'address as mode in: the address in the import functions and procedures don't are changed. when there are a change, the change is just 
    in the data that address point to. this is a standard pratice in ada bind world. we dont use 'in out' mode because the address don't are changed.

2) object'address  and   for object'address use 'var':  a) remember by the src code, the true 'lengths' are saved and used without
violate the address space (really this is my responsability as programmmer) b) and 
(besides some bug by off-one not yet hunted).  c) this is sure enforced.  d) I get a instantaneos segfault if this 
dont are enforced. e) this 'enforcement' is transparent to user. f) the user dont have access to this 'internals' , It is isolated from his/her.

3) besides an aparent violation, a) this was necessary to get values, in reality a 'view change'  to get the real values. compilers obligied me 
to do this, afters some months, figthing against some linux patchs (permantent patchs) and segfault in mswindows. Besides the harmless and legitimate use
without 'view change', gcc gnat linux and mswindows  dont permited  this.

4) import var convention c: a) the mostly vars is embedded from _c vars in adare-net c sources_. the Ada RM made a excption in this case when this is
imported vars.

etc.

From now:

I can transform mostly imported vars in static functions.

Pleeease All,  Say us What you want and or What you complains(with filename and line_number) and yours sugestions.

Ah! The Version of Ada is 202x.

Enjoy with us!

Best Whishes, Dani.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ANN: Adare_net Ada network lib
  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
  2 siblings, 0 replies; 17+ messages in thread
From: Daniel Norte Moraes @ 2021-12-30 21:15 UTC (permalink / raw)


Em sexta-feira, 1 de outubro de 2021 às 14:33:45 UTC-3, DrPi escreveu:
> Le 30/09/2021 à 22:10, Daniel Norte Moraes a écrit : 
> > Em quinta-feira, 30 de setembro de 2021 às 09:24:34 UTC-3, DrPi escreveu: 
> >> Le 27/09/2021 à 06:32, Daniel Norte Moraes a écrit : 
> >>> Em quarta-feira, 22 de setembro de 2021 às 08:07:06 UTC-3, joak...@kth.se escreveu: 
> >>>> onsdag 22 september 2021 kl. 11:16:13 UTC+2 skrev AdaMagica: 
> >>>>>> 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. 
> >>>> Thanks for clearing that up AdaMagica, I wasn't aware. 
> >>>> 
> >>>> Best regards, 
> >>>> Joakim 
> >>> 
> >>> Really? They _are_ Pure. 
> >>> I used linters extensively to result in this. one of these linters made hard use o gnat and gprbuild as his backend. 
> >>> Remember this is target Ada 2012 (update 2016) and beyond => there is 
> >>> no guarantee of operation for Ada versions earlier than Ada2012. 
> >> In a Pure package, shouldn't the subprograms also be Pure ? 
> >>> 
> >>> for now Adare_Net support: 
> >>> MSwindows and Linux. 
> >>> 
> >>> was tested in: 
> >>> Mswindows => starting amd64 windows seven sp1 + msys2 gcc-10.3 gnat-10.3 gprbuild-2021 
> >>> Linux => amd64 gcc-11.1+ gnat-11.1+ gprbuild-2021. 
> >>> 
> >>> 1o.) We need as many volunteers as possible to testing Adare_Net on as many 
> >>> operating systems as possible and reporting his/her result to us. 
> >>> currently linux and mswindows are the targets. 
> >>> 
> >>> Very Very Very Thanks! 
> >>> Enjoy!!! 
> >>> 
> >>> 
> >>> 
> >>> 
> > 
> > Well, :-) 
> > 
> > Why ? 
> > The functions dont are pure ? why? 
> >
> A subprogram returning content read from the network can't be pure. Or 
> there is something I have not understood about the Pure aspect.
> > Maybe we need fix the ARM 2012+ 
> > 
> > The ARM2012 allowed it. gprbuild and gnat just follow ARM :-). 
> > 
> > To made things as a lib be almost all pure (or yet preelaborate) there are a hard and 
> > time consuming way to study and test. This fact is itself the main motive for almost all libs and apps ignore Ada categorizations. 
> > 
> > Then, no one yet say if the lib work... only about pure... why? we need more than a 'freestyle' opinions. 
> >
> My intent is to try Adare_Net. So I started by taking a look at the 
> sources and the first thing I noticed was the Pure aspect of the 
> packages. As I'm far from a Ada expert, and I like to understand things, 
> I asked here about it. 
> 
> Is there a documentation somewhere ?

We will create a pdf with the api,  after upgrading to ada202x and adding support for more operating systems, this includes solving reported 
issues and adding suggestions from all of you, 'pure' and 'global' and 'nonblocking => false' and etc included.

While this, You can use the programs in 'exemple folder'. it contains working client and server src and programs. mostly time Its are in 'pairs' of filenames.
Thanks,
Best Whishes,
Dani.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ANN: Adare_net Ada network lib
  2021-10-12 19:44               ` Egil H H
@ 2021-12-30 21:30                 ` Daniel Norte Moraes
  0 siblings, 0 replies; 17+ messages in thread
From: Daniel Norte Moraes @ 2021-12-30 21:30 UTC (permalink / raw)


Em terça-feira, 12 de outubro de 2021 às 16:44:33 UTC-3, ehh.p...@gmail.com escreveu:
> On Tuesday, October 12, 2021 at 5:49:58 PM UTC+2, Shark8 wrote: 
> > On Thursday, September 30, 2021 at 6:24:34 AM UTC-6, DrPi wrote: 
> > > Le 27/09/2021 à 06:32, Daniel Norte Moraes a écrit : 
> > > > Em quarta-feira, 22 de setembro de 2021 às 08:07:06 UTC-3, joak... 
> > > >> onsdag 22 september 2021 kl. 11:16:13 UTC+2 skrev AdaMagica: 
> > > >>>> 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. 
> > > >> Thanks for clearing that up AdaMagica, I wasn't aware. 
> > > >> 
> > > >> Best regards, 
> > > >> Joakim 
> > > > 
> > > > Really? They _are_ Pure. 
> > > > I used linters extensively to result in this. one of these linters made hard use o gnat and gprbuild as his backend. 
> > > > Remember this is target Ada 2012 (update 2016) and beyond => there is 
> > > > no guarantee of operation for Ada versions earlier than Ada2012. 
> > > In a Pure package, shouldn't the subprograms also be Pure ? 
> > Yes...ish. 
> > As mentioned upthread, you can lie about there being no internal state... and this can still be "interfacially" pure; consider a FIBONACCI function which is memoized (Function F(N: Positive) return Positive) -- internally it has the memo to look up F(N), which is obviously state, but externally any F(X) will return the same value given the same inputs. / Perhaps we should allow aspect PURE on subprograms, as well as introduce an aspect STATIC [having (user-defined) static-functions would, in particular, allow some nice "macro-lite" functionality].
> Well, aspect Static for expression functions is coming... 
> http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai12s/ai12-0075-1.txt?rev=1.15 
> http://ada-auth.org/standards/2xrm/html/RM-4-9.html 
> http://ada-auth.org/standards/2xrm/html/RM-6-8.html 
> 
> 
> -- 
> ~egilhh

Thanks! I Followed Your Suggestion!
Now that there is good support for ada202x in gcc-12, we have started solving the reported issues and adding everyone's suggestions.

https://gitlab.com/daresoft/network/adare_net/-/tree/202x

Beer with us!

Best Wishes and Happy New Year(!),
Dani.

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-12-30 21:30 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2021-12-30 20:56         ` Daniel Norte Moraes

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