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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e8023133274ae02c X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!y43g2000cwc.googlegroups.com!not-for-mail From: "Ludovic Brenta" Newsgroups: comp.lang.ada Subject: Re: procedural vs object oriented Date: 27 Apr 2006 08:17:25 -0700 Organization: http://groups.google.com Message-ID: <1146151045.783087.16330@y43g2000cwc.googlegroups.com> References: <1146039364.130635.181590@v46g2000cwv.googlegroups.com> <871wvjh9te.fsf@ludovic-brenta.org> <1xs8jrwjj0dx2$.1ksjkyqyhimw9$.dlg@40tude.net> <1146134530.434869.47230@t31g2000cwb.googlegroups.com> <16tpmi2zjzfmv.x68lm40hqvl8$.dlg@40tude.net> <1146144042.780839.217550@t31g2000cwb.googlegroups.com> <4450D433.4010708@mailinator.com> NNTP-Posting-Host: 212.190.145.10 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1146151052 31396 127.0.0.1 (27 Apr 2006 15:17:32 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 27 Apr 2006 15:17:32 +0000 (UTC) In-Reply-To: <4450D433.4010708@mailinator.com> User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; SunOS sun4u; fr-FR; rv:1.6) Gecko/20040116,gzip(gfe),gzip(gfe) X-HTTP-Via: 1.1 SEVPXS01 Complaints-To: groups-abuse@google.com Injection-Info: y43g2000cwc.googlegroups.com; posting-host=212.190.145.10; posting-account=ZjNXewwAAADyBPkwI57_UcX8yKfXWOss Xref: g2news2.google.com comp.lang.ada:3959 Date: 2006-04-27T08:17:25-07:00 List-Id: Alex R. Mosteo writes: > Ludovic Brenta wrote: >> But with compiler-provided dynamic dispatching, there *is* uncertainty >> as to how dispatching works and what the targets are. > > This is something I'm not getting in this discussion. Provided that you > know all derived classes, you know all possible dispatchings and you can > validate all for correctness and time the worst one. How's this > different than evaluating all branches in a case? > > It's true that you don't have the information at the calling point, but > you have it elsewhere. The issue is not whether or not you *can* validate dispatching calls; of course you can. The issue is *how much it costs* to do so. (This same argument is also why we use Ada instead of C or handwritten assembly). As you said, the list of all possible call targets is not present at the call site, but spread across the entire program source. You'd have to gather the list of all possible targets for each dispatching call, and review the dispatching machine code *at every call site*. Try to do that on the software you're currently writing. The first step would be for you to come up with a list of all dispatching (not static) calls in your program. If you do just that, you will then start to realise how much effort would be required for full-fledged certification. Furthermore, during maintenance, more possible call targets can appear, affecting previously tested and certified call sites, and requiring you to redo the certification process each time you add a type to a derivation class. In general-purpose programming, you can use all the features of the language that help you write your source code faster; in avionics, you only use those that help you certify your machine code faster. It matters more to reduce the cost of certification than the cost of writing the software, because the former far outweighs the latter. -- Ludovic Brenta.