3 ms·
I wouldn't mind the language adding some syntax for this, based on the java try-with-resource but using error values rather than exceptions. Something like
by red_admiral 2y ago
I wouldn't mind the language adding some syntax for this, based on the java try-with-resource but using error values rather than exceptions. Something like
f, err = with(os.Open(thing)) {
// do stuff
}
// at this point err has the same semantics as your CheckClose
- Cthulhu_ 2y agoI believe your example doesn't introduce any new syntax though. Go is highly resistant to adding syntax (and that's a good thing, it keeps the tooling fast and barrier to entry low).