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-Received: by 2002:ac8:758a:: with SMTP id s10mr8630229qtq.217.1587227669878; Sat, 18 Apr 2020 09:34:29 -0700 (PDT) X-Received: by 2002:aca:5614:: with SMTP id k20mr5802310oib.30.1587227669606; Sat, 18 Apr 2020 09:34:29 -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: Sat, 18 Apr 2020 09:34:29 -0700 (PDT) In-Reply-To: <9f2bfb05-fb5e-45cf-909e-53629b939da3@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=2601:3c3:401:f550:ac8a:3c75:fb31:7e46; posting-account=mOeXzwoAAACt_yXMqECCp_EJfeVMNM-g NNTP-Posting-Host: 2601:3c3:401:f550:ac8a:3c75:fb31:7e46 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> <9f2bfb05-fb5e-45cf-909e-53629b939da3@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Beginning Ada Programming, by Andrew T. Shvets (2020) From: cantanima.perry@gmail.com Injection-Date: Sat, 18 Apr 2020 16:34:29 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:58407 Date: 2020-04-18T09:34:29-07:00 List-Id: On Saturday, April 18, 2020 at 10:29:15 AM UTC-5, AdaMagica wrote: > Just for the wow effect: > > I come from Algol 60, later Pascal. I liked Pascal very much, but what annoyed me was for instance that for looping over arrays, I had to look up the bounds. So I defined functions serving this need. > When I met Ada, this was one of the first wow effects that there are language means for this purpose. Ada 83 had everything I missed in Pascal. Is there any other language on earth providing this? I'm not sure I understand what you're saying, but if A is an array, then: - Modula-2 has HIGH(A) when A is an open array; - Modula-3 has FIRST(A) and LAST(A); - Eiffel has A.lower and A.upper. But many languages these days are designed so that you don't have to bother with the array bounds at all: - C++ and Java have the for (auto a : A) { } construct;*** - Eiffel has an across keyword; - Kotlin and Python have for (a in A) construct; and so forth. So it seems that most popular languages these days allow this. regards john perry ***The C++ and Java versions don't work on low-level arrays. As I recall, Eiffel, Kotlin, and Python bring the machinery of high-level arrays to all arrays.