[personal profile] tangaroa

Consider these changes to the try/catch model of C++ and Java:

  • Every block is a try{} block. The "try" keyword is dropped. All exceptions will filter upwards until they reach a block that catches the exception.
  • The new "recover" keyword returns from a "catch" block to the next line of the context that threw the exception. The exception has a ".scope" object that allows access to the variables that were in scope at the time that the exception was thrown. Whenever an exception happens, programmers could twiddle a few variables and set the program back to where it was before.

Has any language already done this or something similar? How would this affect program design, code quality, and readability? What would language developers need to do to implement these features, and how would it impact performance?


Also posted to HN, where one of the users informs me that I've reinvented the Common Lisp condition system.

Page generated Jan. 22nd, 2026 04:54 pm
Powered by Dreamwidth Studios