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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham 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-7-bit Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsgate.cuhk.edu.hk!news.netfront.net!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: S-expression I/O in Ada Date: Tue, 10 Aug 2010 11:13:04 -0700 Organization: Netfront http://www.netfront.net/ 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: 75.211.17.212 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: adenine.netfront.net 1281463986 10531 75.211.17.212 (10 Aug 2010 18:13:06 GMT) X-Complaints-To: news@netfront.net NNTP-Posting-Date: Tue, 10 Aug 2010 18:13:06 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6 In-Reply-To: Xref: g2news1.google.com comp.lang.ada:13082 X-Original-Bytes: 3802 Date: 2010-08-10T11:13:04-07:00 List-Id: On 08/09/2010 11:47 PM, Natacha Kerensikova wrote: > > 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). Yes. > 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); I was commenting on your ideas about writing an S-expression to a stream, which included operations to open and close a list, and put an atom. I thought this was how you expected a client to output an S-expression. I think the client should just do S : S_Expression := Some_Initialization; Put (File => F, Expression => S); > 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). Right. Here the program would call the single operation, and never look at an S-expression. Your TCP_Info-handling pkg would convert the record into an S-expression, and call a single operation from your S-expression pkg to output the S-expression. Your S-expression library would implement the writing of the expression as a series of steps. The TCP_Info-handling pkg is the client of the S-expression library; the program is the client of the TCP_Info-handling pkg. I was referring to the former. You were apparently talking about the internals of the S-expression library. -- Jeff Carter "Strange women lying in ponds distributing swords is no basis for a system of government." Monty Python & the Holy Grail 66 --- news://freenews.netfront.net/ - complaints: news@netfront.net ---