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-Google-Thread: 103376,703c4f68db81387d X-Google-Thread: 109fba,703c4f68db81387d X-Google-Thread: 115aec,703c4f68db81387d X-Google-Thread: f43e6,703c4f68db81387d X-Google-Attributes: gid103376,gid109fba,gid115aec,gidf43e6,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!z14g2000cwz.googlegroups.com!not-for-mail From: "kevin cline" Newsgroups: comp.lang.ada,comp.lang.c++,comp.realtime,comp.software-eng Subject: Re: Teaching new tricks to an old dog (C++ -->Ada) Date: 24 Mar 2005 11:26:56 -0800 Organization: http://groups.google.com Message-ID: <1111692416.348469.132970@z14g2000cwz.googlegroups.com> References: <4229bad9$0$1019$afc38c87@news.optusnet.com.au> <1110032222.447846.167060@g14g2000cwa.googlegroups.com> <871xau9nlh.fsf@insalien.org> <3SjWd.103128$Vf.3969241@news000.worldonline.dk> <87r7iu85lf.fsf@insalien.org> <87is4598pm.fsf@insalien.org> <1110054476.533590@athnrd02> <1110059861.560004@athnrd02> <422b6d49.1141887367@news.xs4all.nl> <1110830710.027630.241160@g14g2000cwa.googlegroups.com> NNTP-Posting-Host: 192.76.54.23 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1111692420 15839 127.0.0.1 (24 Mar 2005 19:27:00 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 24 Mar 2005 19:27:00 +0000 (UTC) In-Reply-To: User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: z14g2000cwz.googlegroups.com; posting-host=192.76.54.23; posting-account=Thx6EwwAAAAirqf96i7UdETSL0vfyj5f Xref: g2news1.google.com comp.lang.ada:9927 comp.lang.c++:47112 comp.realtime:1690 comp.software-eng:5301 Date: 2005-03-24T11:26:56-08:00 List-Id: adaworks@sbcglobal.net wrote: > "kevin cline" wrote in message > news:1110830710.027630.241160@g14g2000cwa.googlegroups.com... > Ada is every bit as expressive as C++. There is not likely to be > any improvement in the number of KSLOC using C++. Oh, yes, > if we choose to use a cryptic form of C++, with all the little > shortcuts that make the code less readable, we might achieve > some reduction in the KSLOC, but at what cost in understandability? > > Richard Riehle C++ is more expressive because of implicit generic/template function instantiation. The limitations of Ada's explicit instantiation have been shown to be a major impediment to creating advanced type systems, e.g. modeling physical units. Christopher Grein writes at http://www.adapower.com/index.php?Command=Class&ClassID=Advanced&CID=215: [Attempting to model physical units in Ada] "Our attempt leads us to a plethora of overloaded functions. The number of function definitions afforded runs into the hundreds... ...One could object that this definition has to be made only once and for all in a reusable package, and later-on the package can simply be withed and used without any need for the user to care about the package's complexity, but unfortunately the argument is not fully correct. Apart from the most probable compile time explosion, it takes into account only simple multiplication and division. Operations like exponentiation an and root extraction root (n, a) are not representable at all. So we have to confess that our attempt to let the compiler check equations at compile time has miserably failed. The only proper way to deal with dimensions in full generality is either to handle them as attributes of the numeric values that are calculated and checked at run-time or to use preprocessors. Also for these methods, there are many examples to be found in literature." Grein again, at http://home.t-online.de/home/Christ-Usch.Grein/Ada/Dimension.html: "A C++ solution, which is very similar to the Ada one presented here - it does however not include fractional powers - can be found at http://www.fnal.gov/docs/working-groups/fpcltf/html/SIunits-summary.html. The big difference is that C++ templates allow type checking during compile-time, so that no overhead neither in memory space nor in runtime is incurred. In this respect, C++ templates ARE MORE POWERFUL than Ada generics." [Emphasis mine] In my experience, C++ templates have allowed me to write fully type-safe programs at a very high level, an ability which Ada generics simply can not match.