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,fc52c633190162e0 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!out04b.usenetserver.com!news.usenetserver.com!in01.usenetserver.com!news.usenetserver.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 04 Apr 2007 11:04:55 -0500 Sender: jsa@sirius.goldenthreadtech.com Newsgroups: comp.lang.ada Subject: Re: why learn C? 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> From: jayessay Organization: Tangible Date: 04 Apr 2007 12:14:22 -0400 Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: 24.61.34.12 X-Trace: sv3-T6ZyxeiLAI0GuZEQN2tAX7DLrWu8+Ba3gu0wqjz0Kt3BQC3ZnQiRoN/jEmhK+eDMbE+Qslsv6nz9Wrt!vJlgqAKvmEm8KWQnm7Plvph3lED9zmMv3/8qlz871N5BzMfRnEgPDWYE60swlWfSXiK3Df++viUY!U7Oz9NhexpLFadqeUqdBePhI X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.34 Xref: g2news1.google.com comp.lang.ada:14784 Date: 2007-04-04T12:14:22-04:00 List-Id: Markus E Leypold writes: > "kevin cline" writes: > > > 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. This is only half correct and totally misleading. C++ templates, other than being Turing complete, have absolutely nothing to do with Lisp or Lisp like languages. Nothing. And to think otherwise shows a complete ignorance of the matter. This poster probably saw someone somewhere claim that templates are "like" Lisp macros because they are a (very weak) example of metaprogramming. > >> 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? 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. > > I fail to see what the one has to do with the other. They _can_ be related, but in general are not. An example of how something like this might be useful can be seen in this (admittedly artificial) example: Allow a user/programmer to define a dictionary like object while ensuring at _compile_ time that the size of the table implementing it is a prime number. That's something that is easy to do in Lisp. It is at least theoretically possible (if mind numbingly painful) to achieve with C++ templates. I don't think you can achieve this with Ada without writing some sort of external preprocessor. If you can, it would be neat to see. > Indeed, I'd rather not write my own type checker in a lispish > compile time language. That wouldn't be so bad (or even such a big deal), but C++ templates are nothing like this and are in general a clumsy giant PITA. /Jon -- 'j' - a n t h o n y at romeo/charley/november com