|
From: Donal K. F. <don...@ma...> - 2018-01-02 16:17:41
|
On 01/01/2018 06:19, Kevin Kenny wrote: > That sounds rather like what I had in mind. One caveat: > 'return' at present appears to take a FOO and cause the procedure to > return a Just FOO. A cursory reading of the code suggests that it won't > work with a FAIL without some tweaking. (Which would be a good thing > anyway, if it leads to simplification elsewhere.) Yes. There will need to be some sort of widening on the normal exit path, and the error exit path will need something a little smarter than what is there right now. I've added a "procLeave" opcode on the exit path that does the on-procedure-exit exception transformation (things like converting an unscoped [break] into an error) while binding in the name of the procedure; that's on trunk because it works independently of everything else. But now we need to make the return types match up right so that "returnException" can be removed entirely. Thinking about it, it'd also make "procLeave" produce a FAIL instead of the current INT; the real return code will end up packed within the FAIL. That can then be widened to the correct result type, and the widening code will grow a bit more hair. Then it will be just a matter of fixing the metadata... Donal. |