3 ms·
The Java AutoCloseable seems like a cleaner version of the MS __try/__finally: try (MyCloseable c = useSomething()) { // stuff } Why isn't this the pa
by karmakaze 5y ago
The Java AutoCloseable seems like a cleaner version of the MS __try/__finally:
try (MyCloseable c = useSomething()) {
// stuff
}
Why isn't this the path explored? The main difference would be not having extra nested blocks. That seems relatively minor, no? It can be improved arg list:
try (MyCloseable c1 = useSomething(), ElseThing c2 = elseThing()) {
// stuff
}
- CodesInChaos 5y agoThis syntax relies on destructors, which C doesn't have.