Executing this program gives an answer of done, when it should return 5. This is in contrast with both if-then-else and match statements which do return the appropriate value.
We can work around this by assigning the answer to a variable and then listing the variable as the last line of the method, but this should not be necessary.
[Note: We have not yet added exceptions to the static type checker so this is a run-time semantics issues]
Fixed in commit a9998f45ed59 in the JS backend. This is also fixed in the C backend, except that
returns in the finally clause cause the runtime to crash because of mis-handled longjmp buffers.
A try-catch expression always seems to return a value of type Done. See the following example:
Executing this program gives an answer of done, when it should return 5. This is in contrast with both if-then-else and match statements which do return the appropriate value.
We can work around this by assigning the answer to a variable and then listing the variable as the last line of the method, but this should not be necessary.
[Note: We have not yet added exceptions to the static type checker so this is a run-time semantics issues]