[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rather, DSSLs increase modularity, productivity

Daniel Weinreb wrote:

> Miles Egan wrote:
>> I'd describe generics as an attempt to make the type
>> system more flexible.
> OK, if that's what you meant by "loosen".  "Loosen" sounded as if you 
> meant
> "to make the type system less restrictive" as in "to make it more like 
> a language
> where variables are untyped", which would not be accurate.  The most 
> classic
> use case for generics in Java is so that you can have a collection 
> class whose
> elements are specific to one type.  It makes your code nicer since you 
> don't
> need to do a cast on the result of an operation that returns an 
> element of the
> collection, and it means that the checking is done by the compiler 
> instead of
> at runtime.  So you get more static checking, not less.

No, in Java's version of generics the checks are still done at runtime; 
the compiler just generates them for you.

- Christopher