Automatic Resource Management, V.2
Joshua Bloch
jjb at google.com
Mon Apr 20 07:09:45 PDT 2009
Stephen,
On Mon, Apr 20, 2009 at 2:31 AM, Stephen Colebourne <scolebourne at joda.org>wrote:
> 2009/4/20 Joshua Bloch <jjb at google.com>:
> > * 3. Does the construct work properly with “decorated” resources?*
> > try (FileReader fr = new FileReader(path) {
> > try (BufferedReader br = new BufferedReader(fr) {
> > ... // Use buffered reader
> > }
> > }
>
> Would this section be better written:
>
> try (FileReader fr = new FileReader(path); BufferedReader br = new
> BufferedReader(fr) {
> ... // Use buffered reader
> }
>
> ie. the second resource is derived from the first within one ARM block.
Yes, thanks. Fixed.
>
>
> (More generally, I think I'd prefer a single resource per ARM, as I
> think its a lot clearer overall and more consistent, but since you've
> allowed it in the proposal, I assume you'd want to keep to that
> style.)
Yes. May people really care about keeping the nesting depth low, and the
ability to combine resources in a single ARM statement does that for them.
Thanks again,
Josh
More information about the coin-dev
mailing list