Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Genetics explains why you look like your father, and if you don't, why you should.


devel / comp.lang.ada / Automatic Serialization of Dynamic Structures in Ada

SubjectAuthor
* Automatic Serialization of Dynamic Structures in AdaManuel Gomez
`* Re: Automatic Serialization of Dynamic Structures in AdaDmitry A. Kazakov
 `- Re: Automatic Serialization of Dynamic Structures in AdaMatt Borchers

1
Automatic Serialization of Dynamic Structures in Ada

<svtsld$13d2$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6686&group=comp.lang.ada#6686

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!9uvvnGqPNg5toS3RMiHIAA.user.46.165.242.91.POSTED!not-for-mail
From: mgr...@gmail.com (Manuel Gomez)
Newsgroups: comp.lang.ada
Subject: Automatic Serialization of Dynamic Structures in Ada
Date: Fri, 4 Mar 2022 21:26:21 +0100
Organization: Aioe.org NNTP Server
Message-ID: <svtsld$13d2$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="36258"; posting-host="9uvvnGqPNg5toS3RMiHIAA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.5.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: Manuel Gomez - Fri, 4 Mar 2022 20:26 UTC

I wanted to do automatic serialization of Ada types that make use of
dynamic memory management with access types, but the standard solution
only works for object values, not for access values. I've found a
technical report describing a solution for that case, which apparently
was implemented. Does anyone know if this tool is or were publicly
available? Was an AI finally proposed as suggested in the Future Work?

https://core.ac.uk/download/pdf/147904594.pdf

Re: Automatic Serialization of Dynamic Structures in Ada

<svu283$1o7p$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6687&group=comp.lang.ada#6687

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!hzzNxxMX5IPvnEV4b74Cww.user.46.165.242.91.POSTED!not-for-mail
From: mail...@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: Automatic Serialization of Dynamic Structures in Ada
Date: Fri, 4 Mar 2022 23:01:41 +0100
Organization: Aioe.org NNTP Server
Message-ID: <svu283$1o7p$1@gioia.aioe.org>
References: <svtsld$13d2$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="57593"; posting-host="hzzNxxMX5IPvnEV4b74Cww.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.6.1
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Dmitry A. Kazakov - Fri, 4 Mar 2022 22:01 UTC

On 2022-03-04 21:26, Manuel Gomez wrote:
> I wanted to do automatic serialization of Ada types that make use of
> dynamic memory management with access types,

That is impossible to do since the semantics of references access type
implement is unknown. E.g. external references, references inside
managed objects, references to non-movable, non-copyable objects,
references created in certain order etc.

I am using a method where references are either explicitly manifested by
the serialized objects or explicitly converted to offsets by objects
containing them.

> but the standard solution
> only works for object values, not for access values.

If you mean stream attributes remember that they are non-portable and
have very limited use unless overridden.

> Was an AI finally proposed as suggested in the Future Work?

I doubt it could have practical use, e.g. for networking or persistence
purposes.

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

Re: Automatic Serialization of Dynamic Structures in Ada

<03e4ee32-df3f-495d-861f-d580432c0713n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6709&group=comp.lang.ada#6709

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ad4:5fc5:0:b0:435:4420:d056 with SMTP id jq5-20020ad45fc5000000b004354420d056mr6473404qvb.130.1646976415454;
Thu, 10 Mar 2022 21:26:55 -0800 (PST)
X-Received: by 2002:a25:4945:0:b0:61d:546d:aedb with SMTP id
w66-20020a254945000000b0061d546daedbmr6815547yba.147.1646976415121; Thu, 10
Mar 2022 21:26:55 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Thu, 10 Mar 2022 21:26:54 -0800 (PST)
In-Reply-To: <svu283$1o7p$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:193:4101:a3a0:3185:a3b1:bbd1:d53e;
posting-account=1tLBmgoAAAAfy5sC3GUezzrpVNronPA-
NNTP-Posting-Host: 2601:193:4101:a3a0:3185:a3b1:bbd1:d53e
References: <svtsld$13d2$1@gioia.aioe.org> <svu283$1o7p$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <03e4ee32-df3f-495d-861f-d580432c0713n@googlegroups.com>
Subject: Re: Automatic Serialization of Dynamic Structures in Ada
From: mattborc...@gmail.com (Matt Borchers)
Injection-Date: Fri, 11 Mar 2022 05:26:55 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 42
 by: Matt Borchers - Fri, 11 Mar 2022 05:26 UTC

I'm not sure why Dmitry would say this is impossible unless you are actually talking about creating a generic package to serialize objects. Objects to a generic routine would be a black box so you would have to supply the serialization routines to the generic at instantiation. Otherwise, there are certainly cases that may prove impossible or challenging, but I think the OP is thinking of perhaps serializing simpler cases like a linked list, tree, or graph in memory. In this case, it is definitely possible even if the objects in the structure contain other dynamic elements.

If you are serializing a structure where access type links are followed to do a simple traversal of the structure then you don't need distinct IDs for the objects that you are serializing. Otherwise, you probably do in order to fully regenerate the dynamic structure.

My approach to this is to create a 'Read, 'Write, 'Input, and 'Output routines for both the access type and the type being accessed. I do this mostly for completeness, but it's not necessary if the program doesn't need both. You many not need a 'Read and 'Write, but if you need one then use 'Input and 'Output. There is a difference that should be obeyed for proper serialization: 'Output writes any necessary bounds of an array or other container type before writing the data and 'Input expects that bounds information to be available before reading the data. So, I generally have 'Output call 'Write and 'Input call 'Read to avoid duplication of code.

The 'Output on the access type writes a Boolean value before the access value itself - True if not null. Then I write any boundary information necessary then invoke the 'Write on the .all of the access type. For 'Input, it would obviously read the Boolean value and if True read the boundary data and create a new instance of the expected type and then call 'Read to load data into the newly created .all object.

For a linked list, tree, and even a complete graph a simple traversal works fine. For an incomplete graph, you may want to write out the nodes first and then write out coded information for how the nodes are linked so a reconstruction is possible from the input stream.

This method even works for tagged types and the class-wide streaming routines that will rebuild the proper objects because the class-wide streaming routines stream the tag information about the object allowing dispatching on 'Class'Input (if I remember correctly).

Regards,
Matt

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor