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,FREEMAIL_FROM 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 Path: g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!usenet-fr.net!gegeweb.org!aioe.org!not-for-mail From: =?iso-8859-15?Q?Yannick_Duch=EAne_=28Hibou57=29?= Newsgroups: comp.lang.ada Subject: Re: S-expression I/O in Ada Date: Sat, 14 Aug 2010 15:33:07 +0200 Organization: Ada At Home 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> <87k4nylb8c.fsf@ludovic-brenta.org> <4c617774$0$6765$9b4e6d93@newsspool3.arcor-online.net> <2610d347-27cf-4c88-ac18-84f73c7da858@h32g2000yqm.googlegroups.com> <878w4blhzj.fsf@ludovic-brenta.org> <85fc256b-bb92-43f5-9de7-5148f5b23622@k10g2000yqa.googlegroups.com> <87vd7fk1ar.fsf@ludovic-brenta.org> <518d22c5-2a6e-49b3-8022-b82f4402f216@m1g2000yqo.googlegroups.com> <8f73cb40-3988-4039-9ffa-822d703f4a1d@v8g2000yqe.googlegroups.com> <8739uhjvoi.fsf@ludovic-brenta.org> <87y6c9ibg0.fsf@ludovic-brenta.org> NNTP-Posting-Host: YYagVKn1YrNkilfPXbyxag.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 User-Agent: Opera Mail/10.60 (Win32) Xref: g2news1.google.com comp.lang.ada:13282 Date: 2010-08-14T15:33:07+02:00 List-Id: Le Sat, 14 Aug 2010 15:13:51 +0200, Ludovic Brenta = a =E9crit: > type Access_T is access T; > type Internal_T (Atom : Boolean :=3D False) is record > case Atom is > when True =3D> Value : Ada.Strings.Unbounded.Unbounded_Strin= g; > when False =3D> > Car : Access_T; > Cdr : Access_T; > end case; Just a detail : what about an enumerated type instead of a boolean ? type Item_Kinds is (An_Atom, A_List); type Internal_T (Kind : Item_KInds :=3D A_List) is record case Kind is when An_Atom =3D> Value : Ada.Strings.Unbounded.Unbounded_Str= ing; when A_List =3D> Car : Access_T; Cdr : Access_T; end case; Perhaps more expressive (refer to things using their name instead of = predicates) and more resilient (just imagine you want to later have a = special handing of nil). Personal note: I do not agree with the use of a Boolean every where ther= e = is a two element enumeration. Boolean are made for Boolean arithmetic an= d = to represent items of the Boolean set. -- = There is even better than a pragma Assert: a SPARK --# check. --# check C and WhoKnowWhat and YouKnowWho; --# assert Ada; -- i.e. forget about previous premises which leads to conclusion -- and start with new conclusion as premise.