Peter Alexander wrote:
On 18/10/10 11:03 PM, Jonathan M Davis wrote:
Unfortunately, a lot of the programmers I know
tend to react negatively to templates (probably primarily due to how
nasty they
can be in C++), so sadly, it can be hard to sell powerful templates
as a _good_
feature to some folks.
I think it has very little to do with the syntax (although it certainly
plays a part).
I think it has a lot to do with the syntax. What templates do is actually very
simple, but in C++ that simplicity is buried in an impenetrable syntax. I wrote
a compiler for C++ templates, and I still have to look up the syntactic details
whenever I write a template.
The real problem with templates (in my opinion) is that they require a
higher level abstract view of programs that most programmers simply
lack. I think this is the same reason why functional programming escapes
the masses, and why C is still so popular.
Passing a type to a function is conceptually no more difficult than passing the
number 7.