Re:Maybe adding generics to Go is about syntax after all
by cyphar on Tuesday September 04, 2018 @12:07PM
(#17910037)
Right -- people already use defer as a way of mapping errors and doing cleanup in an already awful way:
And unlike handle you can actually give an arbitrary mapping function, while as far as I can tell you'd need to do something like
Rather than the more ergonomic
Or
But whatever -- all of this is pretty useless. The main benefit of check in my mind is actually that you would be able to easily bump your test coverage -- because Go test coverage is based on lines and so the repeated use of
artificially dilutes your test coverage (you don't need to test that every error is propagated -- that's just doesn't make any sense and might not be possible if you are returning directly from os.* functions that don't even have fault-injection).
[ Parent
| on HN ]
There are no comments on this comment yet.