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=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a05:6214:a0f:: with SMTP id dw15mr4387875qvb.236.1587151708098; Fri, 17 Apr 2020 12:28:28 -0700 (PDT) X-Received: by 2002:a9d:7e7:: with SMTP id 94mr341871oto.82.1587151707450; Fri, 17 Apr 2020 12:28:27 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.unit0.net!feeder1.cambriumusenet.nl!feed.tweak.nl!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 17 Apr 2020 12:28:27 -0700 (PDT) In-Reply-To: <007895f7-b923-4267-9801-d0caaaa30838@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=47.185.215.60; posting-account=zwxLlwoAAAChLBU7oraRzNDnqQYkYbpo NNTP-Posting-Host: 47.185.215.60 References: <87muca3vgd.fsf@nightsong.com> <57d49047-0a61-4d13-8822-d004732a3acc@googlegroups.com> <007895f7-b923-4267-9801-d0caaaa30838@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <41ef6a77-3b14-43ff-b6ae-510000a33ad4@googlegroups.com> Subject: Re: Beginning Ada Programming, by Andrew T. Shvets (2020) From: Optikos Injection-Date: Fri, 17 Apr 2020 19:28:28 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:58399 Date: 2020-04-17T12:28:27-07:00 List-Id: On Friday, April 17, 2020 at 12:59:11 PM UTC-5, AdaMagica wrote: > Am Freitag, 17. April 2020 06:07:15 UTC+2 schrieb Andrew Shvets: > > On Tuesday, December 3, 2019 at 8:21:25 AM UTC-5, J-P. Rosen wrote: > > > Le 03/12/2019 =C3=A0 13:33, Lucretia a =C3=A9crit : > > > >> Yes, he is. I had a little conversation on the very first edition > > > >> with him. I esp. objected that he started his examples with using > > > >> Integer rather than user-defined types (which IMHO is the very > > > >> heart of Ada). I do not know whether he changed this. > > >=20 > > > > There's nothing wrong with using integer to start off and then movi= ng > > > > onto defined types. > > > Yes there is! (see my paper at the last Ada-Europe). The first messag= e > > > when you teach Ada is that it is all about defining proper types. You > > > have to start by fighting bad habits from other languages. > > >=20 > > > --=20 > > > J-P. Rosen > > > Adalog > > > 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX > > > Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 > > > http://www.adalog.fr > >=20 > > *shrug* You have your own way of looking at this. However, I really di= d not want to leave someone that is just starting with a long and academic = chapter on types in Ada. It would be boring and discourage someone from le= arning Ada. >=20 > Why must this be boring? >=20 > Define a temperature scale for a home thermometer. It has a measurement r= ange from -30 to +40 =C2=B0C. >=20 > Define a type for values you can read from a foldable meter rod (0 to 2 m= ). What is especially not boring would be to show how the range restriction (o= n, say, an index into a buffer) precluded writing a worm's machine code off= the end as the preclusion of a security vuln commonplace in C. Now that w= ould be an eye opener for most people coming from other languages. What would be especially not boring for the thermometer range restriction (= on, say, an automobile that is a competitor of Toyota) precluded a sensor m= isreading that its absence precluded the gas pedal not getting confused for= the brake pedal as an off-by-one in the periodic polling responses in the = drive-by-wire CAN network (or whatever minor mistake on the CAN caused thos= e crashes). What would be especially not boring would be to show how the range restrict= ion on the low end being 1 or 2 or 3 angle-of-attack sensors could cause di= fferent child packages to be swapped in on a Boeing 737 MAX for each of 3 l= evels of MCAS system integrity with 3 or more AoA sensors begetting a major= ity-rules voting among the sensors, 2 begetting a usage of the most-sane se= nsor, and 1 begetting a turn off of the MCAS (or some such pilot-centric wa= y of not having the software crash the airplane). Range restrictions for the sake of range restrictions are in fact boring bo= rdering on bicycle shedding for the reader. The security that they facilit= ate would definitely enliven the topic.