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-7-bit Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!inka.de!rz.uni-karlsruhe.de!news.belwue.de!newsfeed.arcor.de!newsspool1.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="us-ascii" Content-Transfer-Encoding: 7bit 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> Date: Mon, 2 Apr 2007 09:52:24 +0200 Message-ID: <1lxqyx4ognsed$.ait5qqwujfo8$.dlg@40tude.net> NNTP-Posting-Date: 02 Apr 2007 09:52:24 CEST NNTP-Posting-Host: 57137841.newsspool4.arcor-online.net X-Trace: DXC=C`>F0Ga7U]>=FQB?mjjV504IUKFlA2WbY>86DNcfSJ;bb[5FCTGGVUmh?4LK[5LiR>kg2eoE@<4=eKH0 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:14726 Date: 2007-04-02T09:52:24+02:00 List-Id: On 1 Apr 2007 21:29:03 -0700, kevin cline wrote: > On Mar 30, 4:09 am, "Dmitry A. Kazakov" > wrote: >> On Fri, 30 Mar 2007 07:44:31 +0000 (UTC), Lutz Donnerhacke wrote: >>> * kevin cline wrote: >>>> "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." >> >>> This is correct. C++-Templates itself are a Lisp dialect and Turing complete. >> >> One should be careful with such statements. In fact it is apples and >> oranges, because whatever power templates might have, they are *not* >> executed on the target machine. > > So what? That templates have power = 0 on the machine. You can compute *nothing* using templates. They are simply not executed there. Period. > The discussion was about compile-time type safety, and the > point is that C++ templates, being Turing complete, allow more > thorough compile type checking than is possible in Ada. 1. Here you compare the language of templates (a quite crippled one) with the language in which the Ada compiler was written. Clearly, this comparison cannot be in favor of templates. In case you doubt it, try write a parser and code generator in C++ templates... 2. This all has nothing to do with types, because the meta language of templates does not deal with language objects (types of which are supposed to be checked). Templates are about templates of types, not types. The result of template execution (by the compiler) is a C++ program which is then checked using C++ types system. Thus templates add/remove absolutely nothing to types safety. (Same as Ada generics, BTW) 3. The meta language of C++ templates is itself untyped. In contrast to the language of Ada generics which is typed. So much for types safety. P.S. There should better be neither templates nor generics. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de