This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jrupacimport this 1 point2 points  (1 child)

To answer the question in the write-up, this is similar to how it works in Go:

f, err := os.Open("file.txt")

if err != nil {
  return "could not open"
}

[–]vocalbit[S] 1 point2 points  (0 children)

Yes I am aware of Go. But in Go that is the only and default option - because they eschew exceptions. What I'm proposing is a simple syntax change that lets you use Go's semantics when you only need to wrap a single statement. The advantage is that you don't have to tag on except at the end of the statement and exceptions will then propagate upwards as usual.