On 3/8/02 9:28 AM, "Paul Brannan" <paul / atdesk.com> wrote:

> On Sat, Mar 09, 2002 at 01:14:00AM +0900, Chris Gehlker wrote:
>> I've been dragged, kicking and screaming, to the conclusion that templates
>> are a symptom that C++ is too strongly typed in the first place. They have
>> some nasty side effects too in terms of code bloat and making programs hard
>> to debug. I'm assuming you've read Meyers's books and know how to mitigate
>> the code bloat problem but look again. Isn't he really just using templates
>> to defeat the strong typing built into the language.
> 
> Do you think the problem is with templates themselves, or could they be
> due to the immaturity of the tools available for C++?

I most familiar with gcc and CodeWarrior for C++. I think they're both
pretty mature. The CodeWarrior debugger is really nice on Windows and on the
Mac.
 
> It seems to me that debugging problems introduced by templates are due
> to buggy debuggers.  The code bloat problem is a tradeoff; it's the
> classic speed/size issue.

I should have been more specific. The problem I was thinking of is when you
call into some library and get a compile time error deep in the stl. I've
had this happen a few times, both with libraries that I wrote myself and
hadn't used in awhile and with third party ones. You don't know if there is
a bug in the way you called the library or is internal to the library.
What's worse, you can't localize the bug to any particular part of your main
program. You end up learning about implementation details of the stl,
something you were supposed to be shielded from having to do.

Now an analogous thing can happen with more dynamic languages but it will
happen at run time when you have a stack frame. You can walk backwards an
see where you went wrong pretty quickly.

>> Last time I looked, Java had acquired some primitive generic programming
>> facilities.
> 
> Hmm, I've never heard of this.  Can you point me to some information?

Looking down the thread, Rich beat me to it.
-- 
Nature will bear the closest inspection. She invites us to lay our eye
level with her smallest leaf, and take an insect view of its plain. -Henry
David Thoreau, naturalist and author (1817-1862)