Re: Design of STL was RE: [GD-General] Eiffel
Brought to you by:
vexxed72
|
From: Patrick M D. <pa...@wa...> - 2001-12-24 19:49:30
|
On Mon, 24 Dec 2001, Brian Hook wrote:
> I'm coming back around to liking Java. Since it lacks true generic
> programming, it uses a SmallTalk/Obj-C style of container where casting
> is required. However, this is not fundamentally a bad thing unless
> you're religious about static type checking (in which case, Eiffel seems
> to be a better philosophical match than C++).
You don't need full genericity to support container classes without
casting. Parametric polymorphism is sufficient for that. It's relatively
easy to implement and does not suffer from any code bloat. There are a
number of proposed extensions to Java that include this style of
polymorphism. From what I understand, there are plans to add this add at
some point.
I'd also like to claim that type checking isn't a religious issue -
formalizing type disciplines is the best promising method to achieve a
higher level of software correctness. Some key issues when analyzing a
type system are:
Generality - are meaningful programs rejected?
Accuracy - what kind of properties can be described?
Decidability - is it possible to determine if an expression is
well-typed?
Brevity - how much information must be provided by the programmer?
how much can be inferred by the compiler?
Elegance - how easy is the system to understand? is adequate
feedback given in case of a type error?
Efficiency - how much time is spent analyzing types?
(note that this list comes from some course notes by Frank Pfenning -
likely to appear in a book he is working on called Computation and
Deduction).
Java's container classes support generality, but are weak in accuracy,
decidability, brevity, elegance, and efficiency. I agree that this
doesn't make it fundamentally a bad feature, but we can certainly hope to
do better.
Patrick
|