Re:Show HN: GoWork – A Go Distributed Work Library
by bcgraham on Wednesday July 15, 2015 @08:08AM
(#9890857)
An idea is to include a function in the library called MustNewServer() that panics instead of returning an error. A usability perk of having single return is that the function can be chained, i. e.,
[ Parent
| on HN ]
Re:Show HN: GoWork – A Go Distributed Work Library
by jalfresi on Wednesday July 15, 2015 @10:40AM
(#9891468)
As much as I hate chaining functions, I do like the idiom of declaring that a function may panic with the 'Must' prefix.
As long as there is an alternative function which returns errors :)
Re:Show HN: GoWork – A Go Distributed Work Library
by ryanskidmore on Wednesday July 15, 2015 @08:21AM
(#9890891)
Thanks for the suggestion, i'll add something similar to this when i've got a bit of time. Cheers!
Re:Show HN: GoWork – A Go Distributed Work Library
by nothrabannosir on Wednesday July 15, 2015 @08:20AM
(#9890889)
Great suggestion---I recant my original comment and second this.