This page displays the comments from #32437
organized (manually) into themes for easier reading.
The categorization is necessarily imperfect but hopefully still helpful.
Please forgive the occasional Markdown rendering glitches.
It will be updated periodically.
Mail firstname.lastname@example.org with corrections.
Note that the summary responses are also excerpted into other sections of this page where appropriate.
Experiments and real-world data
Questions & Answers
Are result variables left unchanged by a failed try?
What if a function returns error, error?
Does the expanded rewrite have shadowing problems?
What happens when an error is returned?
What happens if code using try is compiled in older versions of Go?
Why not allow try to apply to non-error types?
Try is not solving a problem
Syntax: Pick a different name
Syntax: Use prefix operator (keyword)
Syntax: Use suffix operator
Syntax: Use # placeholder
Syntax: Add catch (or not)
Built-in functions should not affect control flow
Readability: Try is too easy to miss
Readability: Expressions can get complicated
Readability: Avoid named return values
Readability: Try helps avoid writing long zeroed return lists
Context: Adding context with defer
Context: Try may discourage adding error context
Debugging: Try makes it hard to add print statements
Debugging: Stack traces?
Example: Closing files
Example: Potential use in the standard library
Limitation: Cannot handle non-error-returning functions
Limitation: Cannot simplify other common error reactions
Alternative: go try and defer try
Alternative: Add arguments to try
Alternative: Add must for panic-on-error
Alternative: Make error handling implicit
Alternative: Use tools to write if statements
Alternative: Allow assignments only
Alternative: Generics will help
Alternative: Error switch
Alternative: Variadic try
Alternative: Gofmt try into multiple lines
Alternative: Gofmt if err != nil into one line
Alternative: Target error check, not call
Alternative: Uncalled deferred functions
Alternative: Switch from errors to statuses
Alternative: Try blocks or statements
Alternative: Non-local break, continue, return
Alternative: Try goto
Alternative: Try else
Alternative: Try arrow
Alternative: Predefine err as name of error result
Alternative: Try as terminating statement
Re: Disabling try if it is implemented
Re: Try as “ignoring” errors.
Re: Speed of defer
Re: code evolution with try
Administrivia & minor edits
Recent uncategorized comments