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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC 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-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!newsfeed.straub-nv.de!noris.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: S-expression I/O in Ada Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <547afa6b-731e-475f-a7f2-eaefefb25861@k8g2000prh.googlegroups.com> <1llx0f5m88xj7$.srf8azjmykl0.dlg@40tude.net> Date: Sun, 22 Aug 2010 16:10:49 +0200 Message-ID: <1clkz3b9vub91$.1gyqtyg07uocl$.dlg@40tude.net> NNTP-Posting-Date: 22 Aug 2010 16:10:48 CEST NNTP-Posting-Host: 76eb9368.newsspool4.arcor-online.net X-Trace: DXC=BS04Mo`hn<4]E=H1Q9`7874IUK[QRQ`8?WP>Z1C5@I4 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:13609 Date: 2010-08-22T16:10:48+02:00 List-Id: On Sun, 22 Aug 2010 10:24:16 +0000 (UTC), Natasha Kerensikova wrote: > On 2010-08-19, Dmitry A. Kazakov wrote: >> On Thu, 19 Aug 2010 10:16:00 +0000 (UTC), Natasha Kerensikova wrote: >>> 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; >> >> The type tag in S_Expression'Class is a kind of discriminant. You replaced >> one with another. > > That's more or less the idea: it seems I can't escape using a tag, and I > thought having only a tag might be simpler and cleaner than having both > a tag and a real discriminant, hence my proposition. You often add discriminants later. One possible way to implement a tree: type Abstract_Node is abstract new Ada.Finalization.Limited_Controlled null record; type Leaf is new Abstract_Node with ...; type Branch (Cardinality : Positive) is new Abstract_Node with record Children : Array_Of_Node_Ptr (1..Cardinality); end record; -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de