Re: Why Generics?
- From: "David Blickstein" <db@xxxxxx>
- Date: Fri, 06 May 2005 18:33:56 GMT
> My reason is simply that people have been discussing adding "templates" to
Java
> since well before C# was invented (or at least publicly admitted to).
Same
> goes for enums.
Enums were truly needed. They eliminated a class of (what I consider to be)
type-related errors that in my experience was very common: using the wrong
constant in the wrong context. Like substituting LAYOUT.LEFT_JUSTIFIED
for LAYOUT.WEST in a layout manager.
There's a C# feature that I also think is desperately needed in Java.
C# allows you to use the SAME syntax for fields and nyladic (zero arguments)
methods. This allows you to abstract the implementation of the field so
that fields can be re-implemented as methods without breaking existing code.
This is a very common occurrence. SOmething starts out with a static value
and ends up being a dynamic value.
I'm getting someone on the Java committee to propose this.
.
- Follow-Ups:
- Re: Why Generics?
- From: Chris Uppal
- Re: Why Generics?
- From: Mike Schilling
- Re: Why Generics?
- References:
- Why Generics?
- From: David Blickstein
- Re: Why Generics?
- From: Eric Sosman
- Re: Why Generics?
- From: Chris Uppal
- Re: Why Generics?
- From: Mike Schilling
- Re: Why Generics?
- From: Chris Uppal
- Why Generics?
- Prev by Date: Re: Exception trying to set the method "setDate" of class PreparedStatement
- Next by Date: collection API and Null elements
- Previous by thread: Re: Why Generics?
- Next by thread: Re: Why Generics?
- Index(es):
Relevant Pages
|