Created
November 12, 2014 20:49
-
-
Save mattknox/85f3e9e68772b145c6f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// candidate syntax for a go-like language with less boilerplate around error return | |
func doStuff() (string, error) { | |
var err error | |
returnOn err, func() { return nil, err } // return the result of calling func if variable is ever non-nil | |
thing1, err := possiblyFailingCall() | |
thing2, err := possiblyFailingCall(thing1) | |
thing3, err := possiblyFailingCall(thing2) | |
thing4, err := possiblyFailingCall(thing3) | |
return thing4, err | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment