Error trapping with Dyalog APL: Difference between revisions

Jump to navigation Jump to search
Miraheze>Adám Brudzewsky
Miraheze>Adám Brudzewsky
Line 68: Line 68:
=== Restarting the application ===
=== Restarting the application ===


For reasons explained in a minute we now have to define the “Restart the application” procedure. For this, for the first time we do not use the <source lang=apl inline>'E' statement but the <source lang=apl inline>'C'</source> statement. The ''C'' is short for ''Cut back''. This instructs APL to cut the status indicator back to the level where <source lang=apl inline>⎕TRAP</source> '''is localized''' – that is not  necessarily where it was set – and execute the expression in the 3rd argument there. However, if <source lang=apl inline>⎕TRAP</source> is not localized at all, i.e. it is in the workspace, the status indicator is cut back completely and the expression is executed in the workspace.
For reasons explained in a minute we now have to define the “Restart the application” procedure. For this, for the first time we do not use the <source lang=apl inline>'E'</source> statement but the <source lang=apl inline>'C'</source> statement. The ''C'' is short for ''Cut back''. This instructs APL to cut the status indicator back to the level where <source lang=apl inline>⎕TRAP</source> '''is localized''' – that is not  necessarily where it was set – and execute the expression in the 3rd argument there. However, if <source lang=apl inline>⎕TRAP</source> is not localized at all, i.e. it is in the workspace, the status indicator is cut back completely and the expression is executed in the workspace.
<source lang=apl>
<source lang=apl>
⎕TRAP,←⊂(#.Events.RestartAppl 'C' '→∆Restart')
⎕TRAP,←⊂(#.Events.RestartAppl 'C' '→∆Restart')

Navigation menu