|
Re: What's up with Diggins?
|
Posted: Jan 17, 2006 7:07 AM
|
|
> There are two main kinds of foolishness; that done out of > stupidity and that done out of cleverness. A lot of the > advanced template techniques fall into the second > category. The standard libraries are a incredible > intellectual achievement, but the first rule of good > library design is broken; the user of the libraries is not > protected from the complexity of the implementation. > (Consider list<int,std::allocator<int> > etc, and that's a > simple type.).
The second parameter is defaulted, so you don't have to provide it (and allocators are debated in the C++ community, as they are typically not used). What's complicated about:
list<int>
?
Or, to put it another way, do you have a better example?
> A general observation about templates is that they are > often premature optimization. It's difficult to control > rampant inlining and this is often for code where the > performance is hardly effected (e.g. iostreams).
This one-sided view is unfortunately all too common. Early binding is not all about efficiency, and that may not be the most important factor (if it is a factor, at all) in using them. By having early binding, you also get early error messages, rather than (as in Java before it, too, got generics) being able to insert an Apple into a list, and try to extract it as an Orange, and get a ClassCastException at run-time...
> This may seem trollish, but more in sadness than in anger, > as they say. Most programs can be more productively > written in higher-level languages.
Languages such as?
In my experience, with C++, using the right libraries, you can get any level of abstraction as you like. I think the problem in the programming field has more to do with people, than with languages. What I'm talking about is Jim Coplien's remark about the state of the software development field: "Incompetence is rampant."
We can get very far with what we have, much farther than what is typically done (judging typical production code), than what we currently do, using any language at our disposal.
|
|