comp.lang.ada
 help / color / mirror / Atom feed
From: Natacha Kerensikova <lithiumcat@gmail.com>
Subject: Re: S-expression I/O in Ada
Date: Wed, 11 Aug 2010 04:38:59 -0700 (PDT)
Date: 2010-08-11T04:38:59-07:00	[thread overview]
Message-ID: <98284e63-8db5-4de1-b3f6-08dff97b6579@z28g2000yqh.googlegroups.com> (raw)
In-Reply-To: 7n73yzwym49n$.1f5vg0mbw5jf3$.dlg@40tude.net

On Aug 11, 12:37 pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> On Wed, 11 Aug 2010 02:43:58 -0700 (PDT), Natacha Kerensikova wrote:
> > On Aug 10, 5:46 pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
> > 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.

Indeed, but to encode anything I need to access it, i.e. having it
live in the RAM. That's exactly what my in-memory serialized are for.

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

I meant the size of the serialized representation. I can't store or
transmit something when I don't know the size of what is to be stored
or to be transmitted. If you want to transfer id instead of objects,
fine, then the id is the transmitted object and I have to know its
size. Using id is just moving the problem without solving it.

>  What is the intended S-expression implementation according to the
> OSI classification?

The primary intended use of this implementation is disk file I/O,
which doesn't fit well into the OSI classification.

When I used its C counterpart over a network, it has always been over
stream sockets (UNIX stream sockets or TCP sockets), so it's clearly
above the transport layer. I've never been able to figure out what is
what on the level 5 and above, but that's where my implementation
would be.

Now real-life S-expressions are used as a part of SPKI and IMAP. I
think IMAP is on level 7, but I'm not that tells us where IMAP S-
expressions are; and I haven't found enough information about SPKI to
know where it is, but from its purpose I guess it's probably also on
level 5 or above.

I don't know how this information helps you though.

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

When we are talking about a S-expression object, considering I
understand the word "object" as something that lives in RAM, then yes
we are in #2.

But this isn't required: my proposed Sexp_Stream never actually
construct a S-expression object, it serializes S-expression stuff
directly into the underlying stream, around the provided
serializations that are atoms.

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

#1 using S-expression storage format is a choice driven by existing
data being in that format and personal taste.

#2 constructing a S-expression object in memory, is something that may
or may not be needed, depending on the application. Parsing a
configuration like my tcp-connect example does not, hence my
proposition of Sexp_Stream which functions without S-expression
objects in memory. My S-expression templates still seem (to me) to
require a S-expression object in memory (to be handed around to the
correct handler after dispatch).

When I proposed my Sexp_Stream, I postponed the design of a S-
expression object library, because it would be built upon the
Sexp_Stream which isn't fixed yet. And depending on Ludovic Brenta's
progress, I might never design my S-expression object and re-use his.

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

I would if I were implementing a TCP library based on something of
lower OSI-level.

Now I'm writing a S-expression library based on TCP sockets (or disk
streams), so I don't care about TCP details. However I do care about S-
expression details, among which is the "verbatim encoding".

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

And what do you deduce from this?

In the fourth level of quote above, I'm basically asking whether I
correctly understood your idea by reformulating it and asking for
confirmation ("…, right?").

Third level of quote, you seem to agree with a restriction.

Second level of quote, I try to understand the restriction.

And now I still don't know whether the idea in the fourth quote level
is right or wrong, and if it's wrong what it needs to be set right.
That's indeed a sad circle, and I don't even have a clue of what mixed
abstractions have to do with the circle. That's almost the point where
I stop trying to understand and just give up everything, Ada looks way
above my brain's capabilities.

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

Indeed, because S-expressions assume the serialization of objects
(into atoms) is already solved, and address the problem of serializing
a higher level of information about these objects.

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

I still haven't found what PPN is, but from your description it looks
similar to my S-expression with semantics provided by an interpreter.

What I need can be basically examplified as the following S-expression
being sent to a list-of-object objects:
("<h1>Contents of " (title) " list</h1>"
    (for-each-item "<h2>" (title) "</h2><p>" (text) "</p>"))

In the first list line, atoms (double-quoted) are taken as-is into the
output HTML stream. (title) is a call to the list's "title" function,
which is substituted by that particular list's title. Then the "for-
each-item" function is called, which sends its arguments to each of
item of the list. Here again, following atoms are copied as-is, and
this time (title) is interpreted by item objects and substituted by
the item's title, and then the item's text substitutes (text).

That doesn't sound like an alien use of operations being passed as an
argument to another operation.



Regards,
Natacha



  reply	other threads:[~2010-08-11 11:38 UTC|newest]

Thread overview: 252+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-01 12:17 S-expression I/O in Ada Natacha Kerensikova
2010-08-01 12:53 ` Dmitry A. Kazakov
2010-08-01 17:35   ` Natacha Kerensikova
2010-08-01 18:49     ` Dmitry A. Kazakov
2010-08-01 20:06       ` Natacha Kerensikova
2010-08-01 21:13         ` Dmitry A. Kazakov
2010-08-02  7:17           ` Georg Bauhaus
2010-08-02  7:58             ` Dmitry A. Kazakov
2010-08-07  7:23           ` Natacha Kerensikova
2010-08-07  8:39             ` Dmitry A. Kazakov
2010-08-07 12:56               ` Natacha Kerensikova
2010-08-07 14:23                 ` Dmitry A. Kazakov
2010-08-08 12:23                   ` Natacha Kerensikova
2010-08-08 13:01                     ` Dmitry A. Kazakov
2010-08-08 13:49                       ` Natacha Kerensikova
2010-08-08 15:15                         ` Dmitry A. Kazakov
2010-08-09  9:55                           ` Natacha Kerensikova
2010-08-09 10:56                             ` Dmitry A. Kazakov
2010-08-10  8:56                               ` Natacha Kerensikova
2010-08-10 10:17                                 ` Georg Bauhaus
2010-08-10 10:36                                 ` Dmitry A. Kazakov
2010-08-10 12:06                                   ` Natacha Kerensikova
2010-08-10 15:46                                     ` Dmitry A. Kazakov
2010-08-10 21:22                                       ` Simon Wright
2010-08-11  7:37                                         ` Dmitry A. Kazakov
2010-08-11 17:32                                           ` Simon Wright
2010-08-11 17:53                                             ` Dmitry A. Kazakov
2010-08-11  9:43                                       ` Natacha Kerensikova
2010-08-11 10:37                                         ` Dmitry A. Kazakov
2010-08-11 11:38                                           ` Natacha Kerensikova [this message]
2010-08-11 12:58                                             ` Robert A Duff
2010-08-11 15:30                                               ` Natacha Kerensikova
2010-08-11 23:39                                                 ` Randy Brukardt
2010-08-12  1:31                                                   ` Robert A Duff
2010-08-12  8:53                                                   ` Natacha Porté
2010-08-12  9:22                                                     ` Georg Bauhaus
2010-08-13  9:43                                                       ` Natacha Kerensikova
2010-08-10 21:56                                 ` Randy Brukardt
2010-08-09 15:40                             ` Simon Wright
2010-08-09 16:35                               ` Robert A Duff
2010-08-10  0:51                                 ` Randy Brukardt
2010-08-10  1:00                                   ` Jeffrey Carter
2010-08-10 21:36                                     ` Randy Brukardt
2010-08-10 22:24                                       ` Jeffrey Carter
2010-08-10 12:50                                   ` Robert A Duff
2010-08-10 22:06                                     ` Randy Brukardt
2010-08-09 18:37                               ` Natacha Kerensikova
2010-08-09 19:10                                 ` Robert A Duff
2010-08-08 14:08                     ` Duke Normandin
2010-08-08 15:34                     ` Robert A Duff
2010-08-08 18:24                       ` Dmitry A. Kazakov
2010-08-08 20:03                         ` Robert A Duff
2010-08-08 20:39                           ` Dmitry A. Kazakov
2010-08-08 21:08                             ` Robert A Duff
2010-08-09  6:50                               ` Dmitry A. Kazakov
2010-08-09 13:48                                 ` Robert A Duff
2010-08-09 14:38                                   ` Dmitry A. Kazakov
2010-08-09 15:14                                     ` Georg Bauhaus
2010-08-09 16:11                                       ` Dmitry A. Kazakov
2010-08-09 16:46                                         ` Georg Bauhaus
2010-08-09 17:05                                           ` Robert A Duff
2010-08-09 18:29                                             ` Georg Bauhaus
2010-08-09 19:18                                               ` Robert A Duff
2010-08-10  8:21                                                 ` Georg Bauhaus
2010-08-09 20:40                                           ` Dmitry A. Kazakov
2010-08-09 22:21                                             ` Georg Bauhaus
2010-08-10  7:07                                               ` Dmitry A. Kazakov
2010-08-09 16:47                                         ` Robert A Duff
2010-08-09 19:59                                           ` Dmitry A. Kazakov
2010-08-09 21:34                                             ` Robert A Duff
2010-08-09 22:29                                               ` Jeffrey Carter
2010-08-10  7:48                                               ` Dmitry A. Kazakov
2010-08-09 21:54                                             ` _FrnchFrgg_
2010-08-09 22:32                                               ` Georg Bauhaus
2010-08-10  7:16                                               ` Dmitry A. Kazakov
2010-08-10 11:06                                                 ` _FrnchFrgg_
2010-08-10 11:19                                                   ` Dmitry A. Kazakov
2010-08-10 23:04                                                     ` _FrnchFrgg_
2010-08-11 14:10                                                       ` Dmitry A. Kazakov
2010-08-11 17:51                                                         ` Structural unification (pattern matching) in Ada [was: Re: S-expression I/O in Ada] _FrnchFrgg_
2010-08-11 18:06                                                           ` Dmitry A. Kazakov
2010-08-11 19:43                                                           ` Robert A Duff
2010-08-11 20:26                                                             ` (see below)
2010-08-11 21:21                                                               ` Structural unification (pattern matching) in Ada Simon Wright
2010-08-12 12:43                                                             ` Structural unification (pattern matching) in Ada [was: Re: S-expression I/O in Ada] _FrnchFrgg_
2010-08-10  1:06                                             ` S-expression I/O in Ada Randy Brukardt
2010-08-09 16:50                                       ` Robert A Duff
2010-08-09 18:32                                       ` Natacha Kerensikova
2010-08-09 19:06                                         ` Jeffrey Carter
2010-08-09 19:24                                           ` Robert A Duff
2010-08-09 19:35                                         ` (see below)
2010-08-09 17:00                                     ` Robert A Duff
2010-08-09 20:27                                       ` Dmitry A. Kazakov
2010-08-09 21:30                                         ` Robert A Duff
2010-08-10  1:17                                         ` Randy Brukardt
2010-08-10  6:48                                           ` Dmitry A. Kazakov
2010-08-10 21:42                                             ` Randy Brukardt
2010-08-11  8:02                                               ` Dmitry A. Kazakov
2010-08-11 23:18                                                 ` Randy Brukardt
2010-08-12  6:20                                                   ` Dmitry A. Kazakov
2010-08-12 20:56                                                     ` Randy Brukardt
2010-08-13  6:56                                                       ` Dmitry A. Kazakov
2010-08-14  0:52                                                         ` Randy Brukardt
2010-08-09 18:55                                   ` Jeffrey Carter
2010-08-09 18:20                               ` Natacha Kerensikova
2010-08-09 19:19                                 ` Robert A Duff
2010-08-07 15:38             ` Jeffrey Carter
2010-08-07 17:01               ` Natacha Kerensikova
2010-08-08  6:52                 ` Jeffrey Carter
2010-08-08 13:11                   ` Natacha Kerensikova
2010-08-08 15:24                     ` Robert A Duff
2010-08-09 18:00                       ` Natacha Kerensikova
2010-08-09 18:09                         ` Robert A Duff
2010-08-08 20:34                     ` Jeffrey Carter
2010-08-09 18:10                       ` Natacha Kerensikova
2010-08-08 10:26                 ` Simon Wright
2010-08-08 11:44                   ` Dmitry A. Kazakov
2010-08-08 11:48                     ` Dmitry A. Kazakov
2010-08-08 14:05                   ` Natacha Kerensikova
2010-08-08 20:11                   ` Jeffrey Carter
2010-08-14  1:02             ` Yannick Duchêne (Hibou57)
2010-08-14  9:53               ` Georg Bauhaus
2010-08-14 11:32               ` Natacha Kerensikova
2010-08-01 22:03     ` Simon Wright
2010-08-02 17:08       ` Pascal Obry
2010-08-02 19:08         ` Simon Wright
2010-08-01 16:01 ` Ludovic Brenta
2010-08-09 18:49   ` Ludovic Brenta
2010-08-09 19:59     ` Natacha Kerensikova
2010-08-10  0:11       ` Ludovic Brenta
2010-08-10  0:57         ` Jeffrey Carter
2010-08-10  6:47           ` Natacha Kerensikova
2010-08-10 18:13             ` Jeffrey Carter
2010-08-12  9:26               ` Natacha Kerensikova
2010-08-12 10:55                 ` Ludovic Brenta
2010-08-12 12:16                   ` Natacha Kerensikova
2010-08-12 12:46                     ` Ludovic Brenta
2010-08-12 13:23                       ` Natacha Kerensikova
2010-08-12 16:19                         ` Ludovic Brenta
2010-08-12 17:17                           ` Natacha Kerensikova
2010-08-12 18:51                 ` Jeffrey Carter
2010-08-13  9:32                   ` Natacha Kerensikova
2010-08-13 15:52                     ` Ludovic Brenta
2010-08-13 22:53                     ` Jeffrey R. Carter
2010-08-14 11:10                       ` Natacha Kerensikova
2010-08-10 15:48       ` Ludovic Brenta
2010-08-10 15:59         ` Georg Bauhaus
2010-08-12  7:53           ` Ludovic Brenta
2010-08-12 18:55             ` Jeffrey Carter
2010-08-12 19:59               ` Ludovic Brenta
2010-08-12 20:23                 ` Natacha Kerensikova
2010-08-12 20:45                   ` Ludovic Brenta
2010-08-13  8:24                     ` Natacha Kerensikova
2010-08-13  9:08                       ` Ludovic Brenta
2010-08-14 10:27                         ` Natacha Kerensikova
2010-08-14 11:11                           ` Ludovic Brenta
2010-08-14 12:17                             ` Natasha Kerensikova
2010-08-14 13:13                               ` Ludovic Brenta
2010-08-14 13:33                                 ` Yannick Duchêne (Hibou57)
2010-08-12 22:25                 ` Jeffrey R. Carter
2010-08-13  9:10                   ` Natacha Kerensikova
2010-08-13  9:51                     ` Dmitry A. Kazakov
2010-08-14 10:36                       ` Natacha Kerensikova
2010-08-14 10:57                         ` Dmitry A. Kazakov
2010-08-13 19:23                     ` Jeffrey Carter
2010-08-13 19:42                       ` Dmitry A. Kazakov
2010-08-13 20:44                       ` Yannick Duchêne (Hibou57)
2010-08-14  0:57                       ` Randy Brukardt
2010-08-14 10:47                       ` Natacha Kerensikova
2010-08-13 19:36                     ` Simon Wright
2010-08-12 20:11               ` Natacha Kerensikova
2010-08-12 20:22             ` Ludovic Brenta
2010-08-01 18:25 ` Jeffrey Carter
2010-08-01 19:43   ` Natacha Kerensikova
2010-08-01 19:53     ` Ludovic Brenta
2010-08-01 20:00       ` Dmitry A. Kazakov
2010-08-01 20:03     ` Jeffrey Carter
2010-08-01 20:34 ` Georg Bauhaus
2010-08-01 20:44   ` Georg Bauhaus
2010-08-01 21:01 ` anon
2010-08-12 23:26 ` Shark8
2010-08-13  2:31   ` Shark8
2010-08-13  8:56   ` Natacha Kerensikova
2010-08-13 10:30     ` Georg Bauhaus
2010-08-13 15:58     ` Shark8
2010-08-13 21:48     ` Shark8
2010-08-14 11:02       ` Natacha Kerensikova
2010-08-17 17:01 ` Natasha Kerensikova
2010-08-17 19:00   ` Jeffrey Carter
2010-08-18 10:49     ` Natasha Kerensikova
2010-08-18 11:14       ` Ludovic Brenta
2010-08-18 11:59         ` Natasha Kerensikova
2010-08-18 12:31           ` Ludovic Brenta
2010-08-18 13:16             ` J-P. Rosen
2010-08-18 13:55             ` Natasha Kerensikova
2010-08-18 14:40               ` J-P. Rosen
2010-08-20 20:50                 ` Yannick Duchêne (Hibou57)
2010-08-18 15:07               ` Ludovic Brenta
2010-08-19  7:42                 ` Natasha Kerensikova
2010-08-18 12:51           ` Georg Bauhaus
2010-08-18 13:24             ` Natasha Kerensikova
2010-08-18 14:40               ` Georg Bauhaus
2010-08-18 23:50           ` Randy Brukardt
2010-08-18 11:22       ` Georg Bauhaus
2010-08-18 12:02         ` Natasha Kerensikova
2010-08-20 21:04           ` Yannick Duchêne (Hibou57)
2010-08-22 10:21             ` Natasha Kerensikova
2010-08-22 10:28               ` Simon Wright
2010-08-22 17:13                 ` Jeffrey Carter
2010-08-22 14:06               ` Dmitry A. Kazakov
2010-08-21 19:36           ` Yannick Duchêne (Hibou57)
2010-08-18 18:08       ` Jeffrey Carter
2010-08-19  8:09         ` Natasha Kerensikova
2010-08-19 10:16           ` Natasha Kerensikova
2010-08-19 10:42             ` Dmitry A. Kazakov
2010-08-22 10:24               ` Natasha Kerensikova
2010-08-22 14:10                 ` Dmitry A. Kazakov
2010-08-19 18:07             ` Jeffrey Carter
2010-08-22 10:43               ` Natasha Kerensikova
2010-08-22 17:17                 ` Jeffrey Carter
2010-08-19 17:59           ` Jeffrey Carter
2010-08-22 10:45             ` Natasha Kerensikova
2010-08-22 17:20               ` Jeffrey Carter
2010-08-24 11:41       ` Natasha Kerensikova
2010-08-25  1:56         ` Jeffrey Carter
2010-08-25 12:18           ` Natasha Kerensikova
2010-08-25 14:07             ` Jeffrey Carter
2010-08-25  8:06         ` Georg Bauhaus
2010-08-25 13:27           ` Natasha Kerensikova
2010-08-25 18:55           ` Simon Wright
2010-08-25 19:19             ` Georg Bauhaus
2010-08-25 19:23               ` Georg Bauhaus
2010-08-25 22:38               ` Simon Wright
2010-08-25 23:55                 ` Georg Bauhaus
2010-08-27 13:19 ` Natasha Kerensikova
2010-08-27 14:57   ` Georg Bauhaus
2010-08-29 10:45     ` Natasha Kerensikova
2010-08-29 13:10       ` Simon Wright
2010-08-29 14:21         ` Natasha Kerensikova
2010-08-29 14:30           ` Niklas Holsti
2010-08-29 13:23       ` Robert A Duff
2010-08-29 13:57         ` Jeffrey Carter
2010-08-29 14:18         ` Britt Snodgrass
2010-08-29 14:29         ` Natasha Kerensikova
2010-08-29 15:12           ` Robert A Duff
2010-09-03 21:52             ` Randy Brukardt
2010-08-29 13:56       ` Jeffrey Carter
2010-08-29 14:34         ` Natasha Kerensikova
2010-08-29 14:55           ` Dmitry A. Kazakov
2010-08-29 15:25           ` Robert A Duff
2010-08-29 18:50       ` Georg Bauhaus
2010-08-29 21:43         ` Simon Wright
replies disabled

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