You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 25, 2025. It is now read-only.
One thing that stood out to me was the large number of try variants, and I wanted to ask about them in a new issue to avoid cluttering up that other thread. We currently have the following:
instr ::= ... | throw x | rethrow
| try bt instr* (catch exnidx instr*)+ end
| try bt instr* (catch exnidx instr*)* catch_all instr* end
| try bt instr* catch_br l
| try bt instr* unwind instr* end
It's clear that try-catch_br needs to be its own separate variant, but I wonder if it would be simpler to combine the other variants:
instr ::= ... | throw x | rethrow
| try bt instr* (catch exnidx instr*)* (catch_all instr*)? (unwind instr*)? end
| try bt instr* catch_br l
One quirk of this formulation is that it would allow for try bt intr* end, which is completely useless. I imagine it would just have the semantics of a normal block. The other obvious change is that this formulation would allow a try to have both catches and an unwind. I imagine the semantics of that would be similar to the semantics of this:
try
try
...
catch
...
end
unwind
...
end
Specifically, if the catch body rethrows, the unwind body is still run afterwards. So this would just allow for saving a level of try nesting.
I don't feel strongly about this at all since it is just a surface syntax change, but I think it might be a nice simplification. I'm curious to hear what other people think and whether this change would complicate anything I've overlooked.