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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM 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 Path: g2news1.google.com!postnews.google.com!x21g2000yqa.googlegroups.com!not-for-mail From: Natacha Kerensikova Newsgroups: comp.lang.ada Subject: Re: S-expression I/O in Ada Date: Fri, 13 Aug 2010 02:43:37 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <547afa6b-731e-475f-a7f2-eaefefb25861@k8g2000prh.googlegroups.com> <9db37b80-acbb-4c9f-a646-34f108f52985@v15g2000yqe.googlegroups.com> <16xmnn0qe5yog.ii1p0ap9yuth$.dlg@40tude.net> <5d1d705a-008a-43f1-aa19-9b4878ec926b@m1g2000yqo.googlegroups.com> <7n73yzwym49n$.1f5vg0mbw5jf3$.dlg@40tude.net> <98284e63-8db5-4de1-b3f6-08dff97b6579@z28g2000yqh.googlegroups.com> <4c63bd5c$0$6760$9b4e6d93@newsspool3.arcor-online.net> NNTP-Posting-Host: 178.83.214.115 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1281692617 3811 127.0.0.1 (13 Aug 2010 09:43:37 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 13 Aug 2010 09:43:37 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: x21g2000yqa.googlegroups.com; posting-host=178.83.214.115; posting-account=aMKgaAoAAAAoW4eaAiNFNP4PjiOifrN6 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.2.3) Gecko/20100524 Firefox/3.6.3,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:13210 Date: 2010-08-13T02:43:37-07:00 List-Id: On Aug 12, 11:22=A0am, Georg Bauhaus wrote: > On 8/12/10 10:53 AM, Natacha Port=E9 wrote: > > > I have to admit I was quite surprised to find my old way of using S- > > expressions to be so extremely more difficult in Ada compared to C > > (whaddoyoumean I can't just feed to strcmp() raw data I've just read > > from a file!?). > > You can "=3D" just those bytes: you'll just have to drop type > checking by using an instance of Unchecked_Conversion of > the-bytes-you-read to String. Isn't that more-than-a-bit un-Ada-ish? But then again there might be simple command_string =3D String(array_of_read_octets); if command_string =3D "my-command" them which would solve the problem. And if said string converter/constructor doesn't exist, I guess the same thing can be done with an ad-hoc String_From_Atom function. But it would be nice if there was a way to make that operation a no-op in machine code (at least on platforms where array-of-octets and String share the same representation, which should be quite often considering the definition of Character). > > But on other hand it might be a good thing to be > > shaken into realizing the deep implication from the difference in > > typing strength. > > The 12K SLOC Python programs on my screen surely would > be a little easier to rewrite if Python had explicit typing. > assert isinstance(this, that) seems a helpful workaround, > but tedious in comparison to strong typing during translation... Explicit typing is what made me drop python. I remember very well the last straw, when I spend a long time chasing around a bug which was cased by a 1 given as a function argument, which was then passed to another function and then another where it divided by 2. However the context was completely floating point, so the 0 obtained was quite a surprise compared to the expected 0.5. And even today I still think 1 and 2 are completely valid floating-point constants. Natacha