Re: [go-nuts] ANN: The universal "check" built-in proposal.

2019-07-08 Thread Robert Engels
Much of the stdlib works in the manner I describe. Yes Go allows invocations on nil interface references, but most implementations will panic. Multiple Close is almost never a good thing, and most implementations guard against it. So in the case where the gerReader() succeeds and getDB() fail

Re: [go-nuts] ANN: The universal "check" built-in proposal.

2019-07-08 Thread Wojciech S. Czarnecki
On Mon, 8 Jul 2019 07:37:20 -0500 Robert Engels wrote: > This will never work because of dependent resource allocation. > And you wouldn’t be able to check resources against nil if they are structs, > so you have no way to properly cleanup up. > If would quickly degenerate back to if err != nil.

Re: [go-nuts] ANN: The universal "check" built-in proposal.

2019-07-08 Thread Robert Engels
This will never work because of dependent resource allocation. And you wouldn’t be able to check resources against nil if they are structs, so you have no way to properly cleanup up. If would quickly degenerate back to if err != nil. As in check(err!=nil){ token, err = getToken() reader,err =

[go-nuts] ANN: The universal "check" built-in proposal.

2019-07-08 Thread Wojciech S. Czarnecki
The `func check(Condition bool) {}` applies to the block that follows. Within this block, every statement that on its left-hand side has any variable that is present in the "Condition" expression is supplemented with an implicit check of `if Condition { goto catch }` form. The 'catch:' label can b