One option is to make this a first-class feature of the language, rather than sugar for something else.
Icon (from 1977) is interesting here.
https://en.wikipedia.org/wiki/Icon_%28programming_language%2...
One option is to make this a first-class feature of the language, rather than sugar for something else.
Icon (from 1977) is interesting here.
https://en.wikipedia.org/wiki/Icon_%28programming_language%2...
Throw an exception means "throw away the context of the failure and then goto some other function". The exchange amounts to:
Something went wrong somewhere!
Where? What?
I knew a moment ago but threw it away for implementation convenience. Here's an object.
Thanks!
Fringe benefits include sacrificing linear types - the zero runtime cost, infallible way of doing deterministic resource cleanup - and embracing the mental dissonance of goto evil unless it doesn't say where it's going to.
Sum types are probably the right thing.