On 3/8/02 11:14 AM, "Chris Gehlker" <gehlker / fastq.com> 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.

Interesting. This depends on your point of view. Having written a lot of
Eiffel I'd say this differently: Meyer is using the strong static typing of
Eiffel to allow generics to be wonderfully flexible. You can see the same
sort of flexibility in languages like Haskell. The flexibility (in this
regard) that both languages (Eiffel and Haskell) provide is very similar to
what Ruby or Smalltalk provide, in my opinion. For what it's worth, I've had
better success getting Smalltalk programmers working well with Eiffel than I
have C++ programmers. I've also written a lot of C++ code, and so I'm
hopelessly biased against it (there, you see that, I didn't have to write
the 'so' :-) and I would say two things: C++ does not have strong static
typing; and that this has something to do with why C++ allows templates to
be used in such horrible ways.

> 
> Last time I looked, Java had acquired some primitive generic programming
> facilities.
> 
>> Writing in a static-typed language does require more boilerplate code,
>> but certainly not on the order of 850% more.  The reason I write less
>> code in Ruby is because of Ruby's standard library more so than it is
>> because Ruby is dynamically typed.
> 
> I agree that 850% doesn't pass the straight face test.

I also think 850% isn't reflective of practice (at the very least he's
assuming all the sources of extra code are independent of each other). On
the other hand, you could probably concoct an example where you could get an
exponential growth of support code (and in practice this would cause you to
re-evaluate your plans and stop doing that :-)