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:a37:e112:: with SMTP id c18mr4835066qkm.467.1587667535238; Thu, 23 Apr 2020 11:45:35 -0700 (PDT) X-Received: by 2002:a05:6830:1e68:: with SMTP id m8mr4598159otr.340.1587667534939; Thu, 23 Apr 2020 11:45:34 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!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: Thu, 23 Apr 2020 11:45:34 -0700 (PDT) In-Reply-To: <41ef6a77-3b14-43ff-b6ae-510000a33ad4@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=2607:fb90:688a:45d9:a196:e3d9:ea12:4619; posting-account=3pYsyQoAAACcI-ym7XtMOI2PDU8gRZS5 NNTP-Posting-Host: 2607:fb90:688a:45d9:a196:e3d9:ea12:4619 References: <87muca3vgd.fsf@nightsong.com> <57d49047-0a61-4d13-8822-d004732a3acc@googlegroups.com> <007895f7-b923-4267-9801-d0caaaa30838@googlegroups.com> <41ef6a77-3b14-43ff-b6ae-510000a33ad4@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <0800ad94-3e49-47dc-9f32-43b0bf6d99c4@googlegroups.com> Subject: Re: Beginning Ada Programming, by Andrew T. Shvets (2020) From: Andrew Shvets Injection-Date: Thu, 23 Apr 2020 18:45:35 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:58477 Date: 2020-04-23T11:45:34-07:00 List-Id: On Friday, April 17, 2020 at 3:28:29 PM UTC-4, Optikos wrote: > 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 editio= n > > > > >> with him. I esp. objected that he started his examples with usin= g > > > > >> 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 mo= ving > > > > > onto defined types. > > > > Yes there is! (see my paper at the last Ada-Europe). The first mess= age > > > > when you teach Ada is that it is all about defining proper types. Y= ou > > > > 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 = did not want to leave someone that is just starting with a long and academi= c chapter on types in Ada. It would be boring and discourage someone from = learning Ada. > >=20 > > Why must this be boring? > >=20 > > Define a temperature scale for a home thermometer. It has a measurement= range from -30 to +40 =C2=B0C. > >=20 > > Define a type for values you can read from a foldable meter rod (0 to 2= m). >=20 > What is especially not boring would be to show how the range restriction = (on, say, an index into a buffer) precluded writing a worm's machine code o= ff the end as the preclusion of a security vuln commonplace in C. Now that= would be an eye opener for most people coming from other languages. >=20 > What would be especially not boring for the thermometer range restriction= (on, say, an automobile that is a competitor of Toyota) precluded a sensor= misreading that its absence precluded the gas pedal not getting confused f= or the brake pedal as an off-by-one in the periodic polling responses in th= e drive-by-wire CAN network (or whatever minor mistake on the CAN caused th= ose crashes). >=20 > What would be especially not boring would be to show how the range restri= ction on the low end being 1 or 2 or 3 angle-of-attack sensors could cause = different child packages to be swapped in on a Boeing 737 MAX for each of 3= levels of MCAS system integrity with 3 or more AoA sensors begetting a maj= ority-rules voting among the sensors, 2 begetting a usage of the most-sane = sensor, and 1 begetting a turn off of the MCAS (or some such pilot-centric = way of not having the software crash the airplane). >=20 > Range restrictions for the sake of range restrictions are in fact boring = bordering on bicycle shedding for the reader. The security that they facil= itate would definitely enliven the topic. All of that is covered in the first chapter. If you go on Amazon and read = the first chapter in the preview mode of the book, I talk about this=20 The only difference to me is how this topic should be taught. I prefer to = wait after introducing the basic types. Ada has an amazing type system and= it can do great things. But it=E2=80=99s a complex topic and I want to in= troduce it in a different way than is usually found in most books.