Hi Elias, that construct is already in place, called an EOC (end-of-context) handler . However, using EOC handlers appears to be easy, but using them properly is extremely difficult, because they require very detailed knowledge of the internals of GNU APL. For example, if your native function is used together with an operator (typically the EACH or the POWER operator) then every iteration of the operator may construct a new )SI frame (and call its EOC handlers when finished, except for the last iteration). And you there could be have multiple EOC handlers in the same )SI frame. There is a fairly large number of previous trouble reports that were caused by improper use of EOC handlers (by myself). EOC handlers are one of the two most difficult (read: error-prone) areas in GNU APL (the other one being output formatting). Besides the trouble that EOC handlers cause, it is not really clear to me under which circumstances it would make sense to defer the handling of an error until the )SI stack is popped (as opposed to handling it right away). If all you need is a APL function cleanup that is called after some other function foo has finished (with an error or not) then you could do something like: cleanup ⊢ '' ⎕EA 'foo' This is somewhat ugly because you do it above foo rather than inside foo, but it is beautiful when compared to an EOC solution /// Jürgen On 04/20/2016 08:31 AM, Elias Mårtenson
wrote:
|
- Re: [Bug-apl] Error handling and IO Alexey Veretennikov
- Re: [Bug-apl] Error handling and IO Elias Mårtenson
- Re: [Bug-apl] Error handling and IO Kacper Gutowski
- Re: [Bug-apl] Error handling and IO Elias Mårtenson
- Re: [Bug-apl] Error handling and IO Juergen Sauermann
- Re: [Bug-apl] Error handling and... Elias Mårtenson
- Re: [Bug-apl] Error handling... Juergen Sauermann
- Re: [Bug-apl] Error handling... Kacper Gutowski
- Re: [Bug-apl] Error handling... Juergen Sauermann
- Re: [Bug-apl] Error handling... Elias Mårtenson
- Re: [Bug-apl] Error handling... Juergen Sauermann
- Re: [Bug-apl] Error handling and IO Juergen Sauermann
- Re: [Bug-apl] Error handling and IO Elias Mårtenson
- Re: [Bug-apl] Error handling and IO Juergen Sauermann
- Re: [Bug-apl] Error handling and IO Elias Mårtenson
- Re: [Bug-apl] Error handling and IO Louis de Forcrand