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 X-Google-Thread: 103376,fc52c633190162e0 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: why learn C? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH 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> <1btkgzzj6zimp.acsq8mkzqz1w$.dlg@40tude.net> <1175488143.324741.283480@y80g2000hsf.googlegroups.com> <1lxqyx4ognsed$.ait5qqwujfo8$.dlg@40tude.net> <1175501959.751535.23190@d57g2000hsg.googlegroups.com> Date: Mon, 2 Apr 2007 14:04:18 +0200 Message-ID: NNTP-Posting-Date: 02 Apr 2007 14:04:18 CEST NNTP-Posting-Host: 279c56e5.newsspool4.arcor-online.net X-Trace: DXC==nFk[EO192[1`E>oC;JXEZ4IUKkgRGkg>gWeanCR X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:14737 Date: 2007-04-02T14:04:18+02:00 List-Id: On 2 Apr 2007 01:19:19 -0700, kevin cline wrote: > On Apr 2, 2:52 am, "Dmitry A. Kazakov" > wrote: > >> 1. Here you compare the language of templates (a quite crippled one) with >> the language in which the Ada compiler was written. > > Probably C or C++. Ask AdaCore. As for me, I have developed compilers of specialized languages in C++, Ada, even in Assembly (with macros). No, I wouldn't advise anybody to use C++ for compiler construction... >> Clearly, this >> comparison cannot be in favor of templates. In case you doubt it, try write >> a parser and code generator in C++ templates... > > The Ada compiler is closed. I can't go modify the Ada compiler and > get it to ensure that the physical units in my Ada program are > consistent. You don't need to modify the compiler for that. If you meant static checks, then it were trivially impossible in general case. Units can be statically checked only under certain [rather rare] conditions. A good design should support static checks where possible and go run-time elsewhere. Templated / generic solution obviously does not scale. > But I can use C++ templates to define a type algebra, Which is a wrong way in a statically typed language, because see above. It should be an algebra of the type *constraints*, which C++ has no notion of. > and > then use those types to insure that the equations in my C++ program > are consistent. Try �C, K, sqrt (m�), then come back. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de