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!news1.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border1.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: Sun, 01 Aug 2010 13:03:14 -0700 Organization: Netfront http://www.netfront.net/ Message-ID: References: <547afa6b-731e-475f-a7f2-eaefefb25861@k8g2000prh.googlegroups.com> NNTP-Posting-Host: 75.242.171.154 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: adenine.netfront.net 1280692999 48111 75.242.171.154 (1 Aug 2010 20:03:19 GMT) X-Complaints-To: news@netfront.net NNTP-Posting-Date: Sun, 1 Aug 2010 20:03:19 +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:12787 Date: 2010-08-01T13:03:14-07:00 List-Id: On 08/01/2010 12:43 PM, Natacha Kerensikova wrote: > > I have to admit I don't really grasp the difference between the vector > you use and the Storage_Array, but it seems I have to research it by > myself before asking here. Storage_Array is a simple array; all instances of the type have a fixed size. So to have a dynamic size, you'd have to do dynamic allocation and memory management yourself. Vectors is an unbounded array abstraction, with all allocation and memory management hidden from the client, and tested by many users. > On the other hand, most of my atoms are indeed strings, and Character > definition from A.1.35 looks exactly like a perfect mapping to bytes. > So if Ada strings have no issue with embedded NUL or non-graphics > character, and if binary data can be losslessly recovered once stored > into an Ada string, it could be the best type for atoms. It will > probably be a while before I reach the level of reading the Reference > Manual cover-to-cover, does anyone knows whether those "if"s are > guaranteed by the standard? String is just an array of Character; there's nothing special about it. No characters have special significance. Unbounded_String is just an unbound variant of String, as the vector would be an unbounded variant of Storage_Array. However, if you store non-Character data, then it would be more appropriate to use a vector of Storage_Element. Possibly you might want to recognize your extensive use of strings by having 3 variants, one for String, one for List, and one for anything else. -- Jeff Carter "People called Romanes, they go the house?" Monty Python's Life of Brian 79 --- news://freenews.netfront.net/ - complaints: news@netfront.net ---