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,fc52c633190162e0 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!o5g2000hsb.googlegroups.com!not-for-mail From: "kevin cline" Newsgroups: comp.lang.ada Subject: Re: why learn C? Date: 2 Apr 2007 00:18:54 -0700 Organization: http://groups.google.com Message-ID: <1175498334.700924.83040@o5g2000hsb.googlegroups.com> References: <1172144043.746296.44680@m58g2000cwm.googlegroups.com> <1172161751.573558.24140@h3g2000cwc.googlegroups.com> <546qkhF1tr7dtU1@mid.individual.net> <5ZULh.48$YL5.40@newssvr29.news.prodigy.net> <1175215906.645110.217810@e65g2000hsc.googlegroups.com> <1175230700.925143.28490@n59g2000hsh.googlegroups.com> <6XbPh.4025$u03.802@newssvr21.news.prodigy.net> <1175491660.511530.58430@y80g2000hsf.googlegroups.com> NNTP-Posting-Host: 76.186.24.40 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1175498336 16095 127.0.0.1 (2 Apr 2007 07:18:56 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 2 Apr 2007 07:18:56 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: o5g2000hsb.googlegroups.com; posting-host=76.186.24.40; posting-account=Thx6EwwAAAAirqf96i7UdETSL0vfyj5f Xref: g2news1.google.com comp.lang.ada:14724 Date: 2007-04-02T00:18:54-07:00 List-Id: On Apr 2, 2:07 am, wrote: > "kevin cline" wrote in message > > news:1175491660.511530.58430@y80g2000hsf.googlegroups.com... > > > For me, the short reason is that Ada generics are not as powerful as C+ > > + templates. The power of C++ templates has enabled me to write > > compact, efficient type-safe application code at a very high level in > > a way which is not possible in Ada. > > Those of us who use Ada write efficient, type-safe application code in > Ada all the time and it is certainly possible in Ada. No doubt you do. I have written efficient type-safe application code in Ada too. But for the most interesting sorts of computationally intensive applications I have written, I found C++'s powerful templates to be indispensable. For example, for a logistics application, variable quantities were modeled as piecewise constant functions of time, but for efficiency there were multiple implementing classes: one for functions that were constant over all time, another for functions that were periodic, another for functions whose variation was defined by a table, and so on. With C++ templates it was a relatively simple matter to define an algebra on those functions so that one could say things like: Time end = integrate_until(f1 * phase_shift(f2,start) / f3 + f4, q); even though f1, f2, f3, and f4 were possibly of different types. In Ada, dozens of lines of generic instantiations would have been needed before the expression could be written.