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!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx01.iad01.newshosting.com!newshosting.com!news.linkpendium.com!news.linkpendium.com!teleglobe.net!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: Thu, 19 Aug 2010 11:07:49 -0700 Organization: Netfront http://www.netfront.net/ Message-ID: References: <547afa6b-731e-475f-a7f2-eaefefb25861@k8g2000prh.googlegroups.com> NNTP-Posting-Host: 75.211.222.144 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: adenine.netfront.net 1282241273 91550 75.211.222.144 (19 Aug 2010 18:07:53 GMT) X-Complaints-To: news@netfront.net NNTP-Posting-Date: Thu, 19 Aug 2010 18:07:53 +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:13517 Date: 2010-08-19T11:07:49-07:00 List-Id: On 08/19/2010 03:16 AM, Natasha Kerensikova wrote: Now it's "Natasha". > And if there is no other way, would it make sense to get rid of the > discriminant with something like: > > type S_Expression is tagged null record; > > package Lists is new Ada.Containers.Indefinite_Doubly_Linked_List > (Element_Type => S_Expression'Class); > > type Atom_Node is new S_Expression with record > Value : Atom; > end record; > > type List_Node is new S_Expression with record > List : Lists.Vector; > end record; This sort of approach would work, though I don't much like it. There's no representation of a complete S-expression, just for the bits one is made up of. This replaces an explicit discriminant with an invisible discriminant; the explicit discriminant is generally clearer. You could also make the explicit discriminant visible, eliminating the Is_Atom function, and declaring subtypes, which would eliminate the need for the explicit exceptions and tests. That might be a good idea. > Natacha So which is it, Natasha or Natacha? -- Jeff Carter "That was the most fun I've ever had without laughing." Annie Hall 43 --- news://freenews.netfront.net/ - complaints: news@netfront.net ---