brian.goetz at oracle.com
Tue Jun 25 06:22:09 PDT 2013
> As someone said one the lambda-dev mailing list, there is no TWR in C#
> because close is called at the end of the for-each instruction.
> Why do you want user to care about releasing resources manually if this
> can be done automatically ?
Because it can't be.
What happens if:
- no one executes a terminal op
- a terminal op throws an exception
- the user asks for an Iterator/Spliterator and doesn't exhaust it
This is analogous the problem with IO streams, where:
InputStream is = ...
isn't good enough; you want try-finally (or TWR) to ensure that cleanup
What you suggest increases the probability that the stream is closed,
but doesn't guarantee it. (It also is far more intrusive in the
More information about the lambda-libs-spec-experts