Error Trapping

For users of dfns, both novice and expert

Re: Error Trapping

Postby ray on Mon Apr 11, 2016 1:58 pm

I support the triple colon approach.

Error trapping is extremely hard to test and even harder to debug,
so changing the existing behaviour should be avoided at all costs.

I agree with Paul's statement about avoiding ⎕TRAP and using :Trap instead.

If I remember correctly, Dyalog APL uses the Sharp APL approach to error trapping rather than the STSC approach. The STSC way required one to "pass the error back" at each level in the stack, as I think is Phil's Acra approach, and John suggested (albeit at the cost of adding extra clutter) above.

To cut back an SI stack thru several levels, trapping the real error at a local level, and then ⎕SIGNALing a User Defined Error in its place, which can be safely explicitly trapped at at higher level can also be a useful technique. And it avoids a lot of "extra clutter".
Ray Cannon
Please excuse any smelling pisstakes.
User avatar
ray
 
Posts: 238
Joined: Wed Feb 24, 2010 12:24 am
Location: Blackwater, Camberley. UK

Re: Error Trapping

Postby paulmansour on Mon Apr 11, 2016 2:41 pm

Like Ray, I was going to say I supported the triple colon solution, but it seems like an admission of failure on the original design, to be now codified in perpetuity. Sort of like JavaScript and =, ==, ===, and who knows how many more equal signs!

I would prefer to bury the original design, if possible.

Is there any use case for the original design?

I suppose someone might have written code that trapped errors in a mid-level dfn, but then expected lower level error to be caught by a higher level ⎕trap or :trap, or not caught at all. Is it worth future-proofing this? More likely this code works by accident anyway. It is entirely possible that this change would make code that does not work the way its author intended, actually work properly!

Is there some other good use?

Regardless, I'll take ::: if I have to. It would let me remove a lot of trad wrappers for my dfns, which are there only to allow :trap or ⎕
paulmansour
 
Posts: 430
Joined: Fri Oct 03, 2008 4:14 pm

Previous

Return to Functional Programming

Who is online

Users browsing this forum: No registered users and 0 guests