stack-bound vs. travelling closures proposal.

Neal Gafter neal at gafter.com
Thu Jun 17 02:20:07 PDT 2010


On Wed, Jun 16, 2010 at 11:52 PM, Reinier Zwitserloot
<reinier at zwitserloot.com> wrote:
> The alternative is working with abstracted exception types, but that cannot
> possibly work either. How would you even do that? "catch (T foo)" does not
> seem to be possible given the concept of erasure. The only pragmatic thing
> one might catch, then, is Throwable or Exception, which one can also do with
> the restricted/portable proposal.

Right.  The main thing one wants to do with exception transparency is
not to catch the exception in the generic code, but to express in the
type system that those exceptions are propogated out to the caller.
It can be caught at a place where the type parameter takes on a
concrete type.  That place might or might not be higher on the call
stack of the same thread.

Consider the sort() method you described.  How does one use
concurrency in the implementation without undermining exception
safety?  Passing the comparator to another thread requires storing it
in a variable, and that variable has to have a type.


More information about the lambda-dev mailing list