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

Re: Rather, DSSLs increase modularity, productivity



Miles Egan wrote:

>
>Perhaps it would be more accurate to say that anonymous classes are
>syntactic sugar to ease the burden of the type system in select
>circumstances? 
>
I would say that Java anonymous classes are to ordinary Java classes as 
lambda expressions
are to named functions.  I just don't see any way to consrue them as 
"easing the burden of the
type system".

> 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.