Re: Why Generics?
- From: Eric Sosman <eric.sosman@xxxxxxx>
- Date: Wed, 04 May 2005 15:07:13 -0400
David Blickstein wrote:
> In Java5, the powers that be added generics.
>
> Can someone please explain to me what value they add to Java? I think they
> are one of the biggest (of many big) mistakes in C++. And I always felt
> that they only reason they were in C++ was because it made the huge mistake
> of not having a common root for the entire class hierarchy: Java's Object
> type.
>
> Java didn't need any language features to implement container classes
> because of this. An reference of type Object can hold ANY Object.
>
> The biggest objection I've ever heard to that is it forces you to cast down
> when you extract from the container. Big deal!
>
> That's nothing compared to what I've always had to go thru to make generics
> work in C++.
>
> Am I missing something or did C++ weenies invade the language committee?
It was the C++ weenies, definitely. You're entirely
correct: The C++ saboteurs have contaminated Java with
generics simply and only to make the language unattractive
and cause its ultimate demise. The Java people have been
suckered into kissing the Bjarne Stone.
Oh, yeah, and one other teeny-tiny thing: If you make
a mistake, it gets diagnosed at compile time instead of at
run time. Which would you rather receive: a compiler error
that you alone see, or a ClassCastException with all the
honchos from The Big Customer watching? If you'd prefer
the former, learn to like generics.
--
Eric.Sosman@xxxxxxx
.
- Follow-Ups:
- Re: Why Generics?
- From: opalpa@xxxxxxxxx
- Re: Why Generics?
- From: Chris Uppal
- Re: Why Generics?
- From: Betty
- Re: Why Generics?
- References:
- Why Generics?
- From: David Blickstein
- Why Generics?
- Prev by Date: Re: BCEL and IfThenElse construct
- Next by Date: Re: Tree abstract data type without SWING paraphernalia?
- Previous by thread: Why Generics?
- Next by thread: Re: Why Generics?
- Index(es):
Relevant Pages
|