From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,24d7acf9b853aac8 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news4.google.com!feeder.news-service.com!news.netcologne.de!ramfeed1.netcologne.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: S-expression I/O in Ada Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <547afa6b-731e-475f-a7f2-eaefefb25861@k8g2000prh.googlegroups.com> <46866b8yq8nn$.151lqiwa0y2k6.dlg@40tude.net> <13b07f2c-2f35-43e0-83c5-1b572c65d323@y11g2000yqm.googlegroups.com> <13tpf7ya3evig$.h05p3x08059s$.dlg@40tude.net> <1lhdkikeh2sif.bd3pon3knbv8.dlg@40tude.net> <7027f0c6-d909-428c-ab8d-6ba1bd7ff4b2@x21g2000yqa.googlegroups.com> <1424bzz54867w.soj1iq72wkwl$.dlg@40tude.net> <9db37b80-acbb-4c9f-a646-34f108f52985@v15g2000yqe.googlegroups.com> <16xmnn0qe5yog.ii1p0ap9yuth$.dlg@40tude.net> <5d1d705a-008a-43f1-aa19-9b4878ec926b@m1g2000yqo.googlegroups.com> Date: Wed, 11 Aug 2010 12:37:36 +0200 Message-ID: <7n73yzwym49n$.1f5vg0mbw5jf3$.dlg@40tude.net> NNTP-Posting-Date: 11 Aug 2010 12:37:35 CEST NNTP-Posting-Host: bbe240da.newsspool2.arcor-online.net X-Trace: DXC=UCd0l\?K\ob_0Po7BmQ3]lA9EHlD;3Ycb4Fo<]lROoRa8kF7hm=FOB6B?feki X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:13112 Date: 2010-08-11T12:37:35+02:00 List-Id: On Wed, 11 Aug 2010 02:43:58 -0700 (PDT), Natacha Kerensikova wrote: > On Aug 10, 5:46�pm, "Dmitry A. Kazakov" > wrote: >> Why don't you send it at once? > > As I said, I can't just insert the raw object in the stream, You can encode it. > I need at least to know its size. No, you don't and you cannot, because the object's size has nothing to do to the object representation in the encoding used for the stream. Consider two systems using common vocabulary. Instead of sending objects you do the ids asking the partner to construct an object for this id. > For example, S-expressions small enough to fit in one packet can be > easily transferred over UDP. S-expression parsers (or at least mine) > handle well fragmented data (even when unevenly fragmented) but fail > when data is missing or mis-ordered, which prevent large S-expressions > to be simply spread over as many packets as needed. However one might > solve this issue by adding a sequence number inside the UDP payload, > along with a mechanism to re-send lost packet; however that would be > (at least partially) re-inventing TCP. You can recode/pack S-expressions into something else. That does not answer the question why. And from you responses it becomes less and less clear where. What is the intended S-expression implementation according to the OSI classification? We tried almost all levels, it looks pretty much everything and nothing, a Ding-an-sich. >>>> What was the problem then? >> >>> The problem is to organize different objects inside a single file. S- >>> expression standardize the organization and relations between objects, >>> while something else has to be done beyond S-expression to turn >>> objects into representations suitable to live in a file. >> >>> [...] >> >> Yes, I don't see how S-expression might help there. They do not add value, >> because the work of serialization or equivalent to serialization is already >> done while construction of the expression object. > > There are two things that are to be serialized: objects into atoms, > and relations between objects into S-expression-specific stuff. The S- > expression object is an unserialized in-memory representation of > relations between serialized representations of objects. The writing > of an S-expression into a stream is the final serialization-of- > relations stage. It is #2? (see below) >> There are two questions to discuss: >> >> 1. The external storage format: S-expressions vs. other >> 2. Construction of an intermediate S-expression object in the memory >> >> You justified #1 by an argument to legacy. You cannot [re-]use that >> argument for #2. (OK, since Ludovic had already done it, you could (:-)) > > I don't re-use that argument. And actually if you followed the > description of my Sexp_Stream, I don't need a S-expression object in > memory, I only need serialized representation of atoms. The rest can > be directly send into a stream. It is not #2, only #1? >>>> Why do you need S-sequence in the memory, while dumping >>>> objects directly into files as S-sequences (if you insist on having them) >>>> is simpler, cleaner, thinner, faster. >> >>> Because I need to examine the S-sequence before writing it to disk, in >>> order to have enough information to write S-expression metadata. At >>> the very lest, I need to know the total size of the atom before >>> allowing its first byte to be send into the file. >> >> That does not look like a stream! But this is again about abstraction >> layers. Why do you care? > > The "verbatim encoding" of an atom, which is the only one allowed in > canonical representation of a S-expression, is defined as follow: a > size, represented as the ASCII encoding of the decimal representation > of the number of octets in the atom, without leading zero (therefore > of variable length); followed by the ASCII character ':'; followed by > the octet sequence of the atom. And TCP requires checksums, port numbers, destination address etc. Do you care of them writing a socket? >>> That sounds like a very nice way of doing it. So in the most common >>> case, there will still be a stream, provided by the platform-specific >>> socket facilities, which will accept an array-of-octets, and said >>> array would have to be created from objects by custom code, right? >> >> Yes, if TCP sockets is what you use. There is a hell of other protocols >> even on the Ethernet, some of which are not stream-oriented. > > But you were talking about Octet'Read and Octet'Write. Aren't these > Ada Stream based stuff? It is a stream interface. You can hang this interface on something that is not a stream, e.g. a text file. (We are hobbling in circles because of mixed abstractions.) >> This is what caused the questions. Because if the problem is serialization, >> then S-expression does not look good. > > Why? Because it's a partial serialization? Yes > Because it serializes stuff you deem as useless? Yes, it does a structure of nested brackets. It does not serialize objects, you need a lot of meat on the carcass. So if the problem is serialization (of objects), then S-expression yet is not a solution. >> The PPN, a simple stack machine. Push arguments onto the stack, pop to >> execute an operation. Push the results back. Repeat. > > Does that allows to push an operation and its arguments, to have it > executed by another operation? Operation is executed, no matter by what. PPN is executable. Whatever you want to be executed has to be expressed in PPN. The PPN itself can be pushed onto the stack if you wanted (=a von Neumann machine). I don't know why would you need that stuff (~trampoline), however. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de