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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM 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!postnews.google.com!f6g2000yqa.googlegroups.com!not-for-mail From: Natacha Kerensikova Newsgroups: comp.lang.ada Subject: Re: S-expression I/O in Ada Date: Mon, 9 Aug 2010 23:47:40 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <547afa6b-731e-475f-a7f2-eaefefb25861@k8g2000prh.googlegroups.com> <87aap6wcdx.fsf@ludovic-brenta.org> <87vd7jliyi.fsf@ludovic-brenta.org> <699464f5-7f04-4ced-bc09-6ffc42c5322a@w30g2000yqw.googlegroups.com> <87ocdbl41u.fsf@ludovic-brenta.org> NNTP-Posting-Host: 178.83.214.115 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1281422860 11489 127.0.0.1 (10 Aug 2010 06:47:40 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 10 Aug 2010 06:47:40 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: f6g2000yqa.googlegroups.com; posting-host=178.83.214.115; posting-account=aMKgaAoAAAAoW4eaAiNFNP4PjiOifrN6 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.2.3) Gecko/20100524 Firefox/3.6.3,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:13033 Date: 2010-08-09T23:47:40-07:00 List-Id: On Aug 10, 2:57=A0am, Jeffrey Carter wrote: > > Natacha Kerensikova =A0writes: > > > For Jeffry Carter (and anybody interested in helping me understand the > > Ada way): here is how it looks like when I haven't thought much about > > it. Notice that all this is completely from the point of view of the > > application using the package, with very few implementation choices. > > If I knew Ada, wouldn't these explanations be pretty much the contents > > of the specification file, with about everything from the body being > > still to invent? How Ada-ish is that thought process? > > In general, describing it from the point of view of "the application usin= g the > package" (often referred to as "the client") is the purpose of the > specification. The body is for the implementation, usually best left unti= l the > specification is finished. So I was doing it the right way, right? (I still have almost no clue about how to make the body, while the specification looks relatively clear to me, even though I can't yet turn in into real Ada). > On the other hand, your proposed operations seem unnecessarily low level = for the > client. You have an internal representation, which is probably hidden fro= m the > client, and an external representation, and operations to write an object= of the > internal representation to that external representation and read the exte= rnal > representation to create an object of the internal representation. Thus, = your > client should probably invoke a single operation to write an object, and = another > single operation to read. I have to admit I can't imagine how to do it in any higher level than this. Or are you suggesting to replace my sequence of procedure calls by something like: NewList(AtomFromString("tcp-connect", NewList(AtomFromString("host", AtomFromString("foo,example", Nil)), NewList(AtomFromString("port", AtomFromPort(PortNb, Nil)), Nil)), Nil); Or maybe we don't the same thing with "object"? Here I have five objects to put into a S-expression as atoms, and they are indeed fairly low-level objects. A higher-level object would be a record type called e.g. TCP_Info, whose reading and writing primitives handle the addition/matching of "host" and "port" and maybe "tcp-connect". So there would be a single operation to read or write such a high-level object by code using it. However the mid-level TCP_Whatever package providing the high-level object and its operation would in turn use the low-level Sexp_Stream (or anything else I might want to experiment with, that's the whole point of modularity). Would you mind hinting me about to do specify my library in a better way? Thanks for your help, Natacha