Exception transparency - lone throws (no checked exceptions)

Neal Gafter neal at gafter.com
Fri Jun 11 11:12:59 PDT 2010


On Fri, Jun 11, 2010 at 11:02 AM, Alessio Stalla <alessiostalla at gmail.com>wrote:

> Well, you could argue that since Java is a fully OO language (apart
> from primitives), adding a functional language concept like closures
> is not a plausible approach.


I don't really get this assertion.  Using that logic one could argue that
since Java is a fully OO language it shouldn't have imperative language
constructs like switch-statements.  There is nothing about function objects
or lambda expressions that conflict with OO concepts.  Smalltalk, the most
pure of the pure OO languages, has closures.

Similar arguments could be made for reflection as well. Reflection
> allows me to call a method bypassing exception type safety in a way.
> But it was theoretically possible, with generics, to modify reflective
> objects to encode exception information, as in Method<throws
> IOException|SQLException>.


No, it wasn't theoretically possible.  The information simply isn't
available at compile-time to be encoded in the type.


More information about the lambda-dev mailing list