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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: Re: Ada Annoyances Date: Wed, 21 Jun 2017 22:40:18 +0200 Organization: A noiseless patient Spider Message-ID: References: <1ac5a44b-4423-443a-a7bb-2864d9abe78f@googlegroups.com> <1498048151.20885.28.camel@obry.net> <96174ea5-852d-44e9-8535-7c1eb24d5326@googlegroups.com> Reply-To: nonlegitur@notmyhomepage.de Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 21 Jun 2017 20:36:38 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="e62502eeb79af883909cac658b46ecd5"; logging-data="4430"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Z/EmFSw9k1Q7/yJ+Lms0khxXAU2ItOPs=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 In-Reply-To: <96174ea5-852d-44e9-8535-7c1eb24d5326@googlegroups.com> Cancel-Lock: sha1:bIT2+RGqh2QuY9UwZ91dAuE2hQQ= Xref: news.eternal-september.org comp.lang.ada:47050 Date: 2017-06-21T22:40:18+02:00 List-Id: On 21.06.17 16:52, pythoner6@gmail.com wrote: > making the compiler work much harder to see that it can devirtualize the function calls Not in Ada, like Dmitry explains; in fact, "devirtualization" isn't really applicable to a language that requires explicit notation for dynamic dispatch in the first place. What did your example do? The earlier proposals for Ada's STL had, e.g., (then) more efficient, but less safe Cursor types whose objects would not know the structure they were running along. Today, faster container operations are available via checking control semantics, part of the language, so if you are sure about what your algorithms are doing... Another thing to consider is that, like in Python, a plain old for loop might be a simple and fast solution if one can overcome "functionist" fear for a moment, or focusing on both sides of iteration control. (Demonstrably parallel loops are in the making BTW.) A low level data structure like a plain old built-in array can be at the heart of a (e.g. generic) subprogram that iterates calling another subprogram (e.g. its generic actual) with each of the array's components. More involved recursive compile time resolution is unlikely to be possible in Ada if its generics remain non-recursive.