Talk:Template metaprogramming
C/C++ Unassessed | ||||||||||
|
This was redirected to Talk:Generic, but no longer needs to since template metaprogramming is now described correctly. (well, let me know if it isn't correct!-)
D
Hmm, a recent edit added TMP code for factorials in D. Since this article is very C++ish the edit is out of place with the rest of the article. Either the article should be reworked to accomodate other languages, or something else need to be done... Mikademus 11:41, 19 March 2006 (UTC)
- Considering that most other languages don't support template metaprograms, it's unsurprising that C++ is the only language mentioned. And considering that and the fact that D isn't especially widely used, it probably would make sense to delete it. 68.238.86.68 14:07, 28 May 2006 (UTC)
- Since no objections has been voiced I removed it per suggestion above. The D-example was redundant and contributed no further information to TMP. The article consitently uses C++ as a vehicle, which is proper since it is the utterly dominant language with TMP facilities, and if other languages should be mentioned it should be through wikilinks to the relevant section in that language's article. I also rephrased a D-advocating edit in the "benefits and drawbacks" section. Mikademus 07:03, 19 July 2006 (UTC)
- If this is to be a C++ only article, it should be renamed "C++ Template Metaprogramming." But it is not so named, and it is common practice in Wikipedia to illustrate programming technique articles with how they work in various languages. The D programming language's template metaprogramming facilities are in many ways more powerful than C++'s. The D example should be put back in.
- The article is not about a comparison of different languages' TMP facilities, but a discussion of TMP using C++ as the illustration. Whether D is superior or not is beside the point - wikipedia is not a place for language holy wars. The article has been rephrased to drive this point home further. The rationale behind useing C++ is that it is the dominant and most used language for this, has the most significant literature on the topic to rely opun, and thus is for all purposes the most beneficial example for the readers. Examples using other languages does not contribute to the topic, unless it is of another aspect of TMP not supported by C++. In fact, since D templates is close to being syntax-synonymous with normal functions if D was used there would be need be no need for example code. Mikademus 10:27, 22 July 2006 (UTC)
- No, it's not a language holy war, simply because there's no contest. You say "The article has been rephrased to drive this point home further", I say the article has been hijacked to prevent D from showing up. If you want to talk about C++ TMP, then do that in a different article. This article is called "Template metaprogramming", not "C++ Template metaprogramming". I think the only reason you are deleting D examples is because you're ashemed of C++ template syntax. (can you prove me wrong?)
- The article is not about a comparison of different languages' TMP facilities, but a discussion of TMP using C++ as the illustration. Whether D is superior or not is beside the point - wikipedia is not a place for language holy wars. The article has been rephrased to drive this point home further. The rationale behind useing C++ is that it is the dominant and most used language for this, has the most significant literature on the topic to rely opun, and thus is for all purposes the most beneficial example for the readers. Examples using other languages does not contribute to the topic, unless it is of another aspect of TMP not supported by C++. In fact, since D templates is close to being syntax-synonymous with normal functions if D was used there would be need be no need for example code. Mikademus 10:27, 22 July 2006 (UTC)
- If this is to be a C++ only article, it should be renamed "C++ Template Metaprogramming." But it is not so named, and it is common practice in Wikipedia to illustrate programming technique articles with how they work in various languages. The D programming language's template metaprogramming facilities are in many ways more powerful than C++'s. The D example should be put back in.
- Since no objections has been voiced I removed it per suggestion above. The D-example was redundant and contributed no further information to TMP. The article consitently uses C++ as a vehicle, which is proper since it is the utterly dominant language with TMP facilities, and if other languages should be mentioned it should be through wikilinks to the relevant section in that language's article. I also rephrased a D-advocating edit in the "benefits and drawbacks" section. Mikademus 07:03, 19 July 2006 (UTC)
- I am a strong supporter of D and I refuse to use C++. However, for the sake of sticking to the topic of template metaprogramming, I can see that having all the example code in just one language an advantage for the topic. And as C++ literature out numbers D literature by astronomical dimensions, it seems reasonable to use C++ as the language of choice for examples in this topic. Of course I'd prefer to use D because (IMNSHO) its template implementation outshines C++'s, but that is not the point here. Maybe someone can start a page to demonstrate the differences in the various template implementations out there in the wild. DerekP 11:23, 23 July 2006 (UTC)
Wow! or Eeeewwww!
As a countercounterweight to what is said below. C++ template metaprogramming is a poor man's version of a number of language features found in a wide variety of languages such as macros in Lisp. It's daunting because it's accidental, not designed, so it lacks proper support (poor error reporting, inconsistency and non-orthogonality, poor compiler implementation and so on). The fact that it's daunting has little to do with its power which is no different from that of any other language with staged computation. Sigfpe 22:00, 21 July 2006 (UTC)
As a counterweight to the opinion below I have to say that I've never yet in any other language found another tool as powerful as templated metaprogramming. It has given me freedom to write incredibly terse and efficient code. Yes, it is difficult to get into, but then again, so is programming. It looks daunting, heck, it is daunting, but so are real-life powertools. Mikademus 18:27, 20 November 2005 (UTC)
I don't know whether to be impressed or disgusted... supposedly it was the intention of the designers of C++ to eliminate the need for macros and tricky macro-based techniques. But now it appears that when they introduced templates, they opened the door to a whole new avenue for creative, uh, hacking?
Now that I have learned about this astonishing technique, I am going to try very hard to forget it. I think I'm going to go away now and write some programs in TECO. Dpbsmith 01:41, 9 Jan 2004 (UTC)
MPSH book
The book Metaprogramming GPUs with Sh actually doesn't have anything to do with template metaprogramming. The word in the title refers to run-time metaprogramming, as opposed to compile time metaprogramming. Sh is a runtime-embedded DSL in C++.
I'm not sure exactly what do with this. As one of the authors of that book, I can say that we're now avoiding the term metaprogramming more and more, because of this common confusion.
I'm leaving in the reference for now, but someone might want to either remove or clarify it.