-
Notifications
You must be signed in to change notification settings - Fork 36
Clarification: Why do try blocks need a result type? #83
Comments
That's exactly the same as with other block instructions. Your example is no different from:
The block type specifies the type of the stack afterwards. Furthermore, at the end of the function, the stack must conceptually contain the function results. So the block type needs to match that. That's enforced regardless of whether there is a |
Thank you for your quick response! Here is an example without result type, validating perfectly:
Here we have |
That example is different because the block isn't the last instruction in the function body, the return is. If you move the return out of the try block in your original example it validates as well. |
That was the hint: |
* Add definition of free index sets * Simplify datacount side condition * Explain convention about multiple occurrences of meta variables
Given the following textual representation:
yields the following validation error:
The following code with an additional result type on the try block passes validation:
I really don't get why the result type on try is needed, as the block either returns directly of rethrows an exception. I'd like to request a clarification on this.
The text was updated successfully, but these errors were encountered: