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,FREEMAIL_FROM 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!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!cyclone1.gnilink.net!spamkiller2.gnilink.net!gnilink.net!trndny02.POSTED!0e8a908a!not-for-mail From: Hyman Rosen User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 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> <9l1Rh.7648$%G4.3596@trndny05> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <7FzRh.24$Rg2.14@trndny02> Date: Fri, 06 Apr 2007 22:16:35 GMT NNTP-Posting-Host: 70.19.106.121 X-Complaints-To: abuse@verizon.net X-Trace: trndny02 1175897795 70.19.106.121 (Fri, 06 Apr 2007 18:16:35 EDT) NNTP-Posting-Date: Fri, 06 Apr 2007 18:16:35 EDT Xref: g2news1.google.com comp.lang.ada:14820 Date: 2007-04-06T22:16:35+00:00 List-Id: Ray Blaak wrote: > it is still the case that "programming" like this with templates > is fundamentally strange. One has to think very differently compared > to the usual programming languages. It is a declarative style involving immutable objects and pattern matching. I understand that this is similar to the way functional programming languages work in some respects. Thinking differently isn't necessarily a flaw, either. > If you really want to test a prime, for example, why on earth > would you not do so at run time, when you actually need the value? Because in C++, these values direct the compiler into different code-generation pathways, allowing the generation of code that is as efficient as if plain constants had appeared in the code. This is generative programming, as expounded by Czarnecki & Eisenecker. > The proper way to program at compile time should be with traditional > program statements that happen to run in the "build" phase. C++ happened to find itself in a position where compile-time programming became possible through a happy accident, and that has led to where it is today. There are people working on more straightforward approaches to this, and if they work out, they may make it into C++.