What's wrong with C++ templates?

Started by
38 comments, last by SabreMan 20 years, 10 months ago
From kuro5hin.org, What''s wrong with C++ templates.
quote: ...just because templates are the best C++ has to offer doesn''t mean they''re good. It turns out that all the problems templates solve were already solved better, before templates were ever introduced, by other languages. In fact, the kludgey way templates work precludes C++ programmers from a lot of the good stuff that nicer solutions have.
Advertisement
Please, do not start next topic like this. Better use search button, and keyword is "template"
"The Gods Made Heavy Metal And They Saw That It Was Good They Said To Play It Louder Than Hell We Promised That We WouldWhen Losers Say Its Over With You Know That It's A Lie The Gods Made Heavy Metal And It's Never Gonna Die"THE GODS MADE HEAVY METAL/by ManOwaR
quote:Original post by Estor
Please, do not start next topic like this.

Like what?
quote:
Better use search button, and keyword is "template"

And what use will that be for sharing an interesting article with the rest of the community?
I don''t see anything on the search results that looks like SabreMan''s (very interesting) link...

Anyway, didn''t we know all along that Lisp is far superior?
Is this going to be a discussion of why you should use a different
language if you want to do the kind of things c++ templates are
trying to do?

Or is it going to be a discussion of how templates are designed in
c++ and could have been designed better, querying the reasons why
the standards committee agreed to specify them as they are?

Or is it going to be a discussion of how generics, such as are in
Python or Lisp, are simply too far removed from a static,
non-introspective language like c++ to be feasible.

Or is it going to be a discussion of how to best use templates in
C++ and the situations where it would be advisible to switch to
another language? After all they're far from useless.

Or is it going to be a slanging match?

Or something else?

It's up to you!

[edited by - petewood on June 3, 2003 8:57:16 AM]
ohhh... forget it, my mistake
CU


[edited by - Estor on June 3, 2003 9:06:34 AM]
"The Gods Made Heavy Metal And They Saw That It Was Good They Said To Play It Louder Than Hell We Promised That We WouldWhen Losers Say Its Over With You Know That It's A Lie The Gods Made Heavy Metal And It's Never Gonna Die"THE GODS MADE HEAVY METAL/by ManOwaR
I don''t consider that article a "what''s wrong with templates" article. It''s more of a "history of generic and compile-time programming" article.

Either way, if you want to complain about C++ templates, then I guess you can go write your games in Lisp...
quote:Original post by fizban75
Either way, if you want to complain about C++ templates, then I guess you can go write your games in Lisp...


How boring this place would be with no room for discussion!

It's only funny 'till someone gets hurt.And then it's just hilarious.Unless it's you.
quote:Original post by fizban75
I don''t consider that article a "what''s wrong with templates" article. It''s more of a "history of generic and compile-time programming" article.

Do you understand the statement `templates are really just a C++ version of Lisp macros geared towards generating type declarations rather than extending C++''s syntax''?
quote:
Either way, if you want to complain about C++ templates, then I guess you can go write your games in Lisp...

You could do that. Or you could just stick your head in the sand and never try to find better ways of doing things.
quote:Original post by SabreMan
Do you understand the statement `templates are really just a C++ version of Lisp macros geared towards generating type declarations rather than extending C++''s syntax''?


Like I said, this doesn''t say what''s wrong with C++ templates or that they don''t do what they were meant to do. It just says that they are similar to something that has been done in another language. I didn''t seen anything in that article that shows that C++ templates are "wrong" but just that they do things in a different way than what''s been done in other languages. Every language is different, each with it''s own costs and benefits and you should just choose the best tool for your job.

quote:You could do that. Or you could just stick your head in the sand and never try to find better ways of doing things.


Wow, what an enlightened discussion we''re having. Such an adversarial tone, tsk, tsk. How old are you? Ten?

This topic is closed to new replies.

Advertisement