There are some possibilities if one wants to guard against forgotten errors - and those are similar to Go:
The above may be set as simply warnings or notices.
And yes, a function returning void! can be invoked on a line by itself.
void!
defer, defer catch and defer try will invoke on any, error and normal return respectively.
defer
defer catch
defer try
The error is likely to be available in the catch version of the defer.
It is an interesting idea to unify them. I’ll give it some thought.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
There are some possibilities if one wants to guard against forgotten errors - and those are similar to Go:
The above may be set as simply warnings or notices.
And yes, a function returning
void!
can be invoked on a line by itself.defer
,defer catch
anddefer try
will invoke on any, error and normal return respectively.The error is likely to be available in the catch version of the defer.
It is an interesting idea to unify them. I’ll give it some thought.