One option would be to have a way to install a callback that is called when a stack frame is unwound. This could be provided to the plugin API, providing the needed infrastructure to the FILE_IO module.
Regards, Elias On 11 April 2016 at 15:07, Kacper Gutowski <[email protected]> wrote: > On Mon, Apr 11, 2016 at 5:27 AM, Elias Mårtenson wrote: > > This seems similar to what GNU APL provides with the ⎕EA feature. The > > problem with this (and, as far as I can tell, also with this Dyalog > feature) > > is that in an error handler, the original error has disappeared. > > If you call some function inside ⎕EA or ⎕EC and then do the clean up, the > only thing you loose is the ability to get suspension inside it. The > original error type and message is still available in ⎕ET and ⎕EM after > ⎕EA or directly returned by ⎕EC. Sadly, the second and third lines of ⎕EM > showing location where the error occured seem indeed to be left out. > Perhaps this could be improved. But if you pass it to ⎕ES, it will simply > appear as if said function were fixed as not suspendable,* which makes > sense to some degree because it's not possible to suspend it under ⎕EA or > ⎕EC. > > Having ability to get suspension and then appropriate resources freed on > unwind regardless if it happens normally, after user's corrective action, > or by clearing stack indicator would be pretty cool, but that sounds like > a big leap in the way stack indicator works. > > -k > > > *Compare: > > ⎕FX 'y F x' 'y+x' > F > F 1 > VALUE ERROR > F[1] y+x > ^ > → > > 0 1 0 0 ⎕FX 'y F x' 'y+x' > F > F 1 > VALUE ERROR > F 1 > ^ ^ > → > > ∇R←(F G) x > [1] ⎕ES 0 0 ⋄ ''⎕EA'R←F x' > [2] ⍝ cleanup here > [3] (,1↑[⎕IO]⎕EM) ⎕ES ⎕ET ∇ > > {⍺+⍵}G 1 > VALUE ERROR > G 1 > ^ ^ > → >
