Re: Readability of exception handling
Alan Baljeu <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
catch(my_function(A,B,C), my_exception(D), ( writeln(my_exception(D)), fail). my_function(_,_,C) :- throw(my_exception(C)). That's all there is to it. Alan Baljeu ________________________________ From: Parker Jones <[email protected]> To: "[email protected]" <[email protected]> Sent: Monday, March 31, 2014 11:19:07 AM Subject: [SWIPL] Readability of exception handling Hello all, I am trying to write some exception handling code that is readable but it always looks unnecessarily complicated. Could someone point me to some code examples of exception handling that are elegant? All the examples I have come across, apart from the very simplest cases, look like a submission to an obfuscation contest. Also, is there a reason Prolog textbooks avoid covering exception handling? Thanks for any suggestions, Parker -------------- next part -------------- HTML attachment scrubbed and removed _______________________________________________ SWI-Prolog mailing list [email protected] https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog -------------- next part -------------- HTML attachment scrubbed and removed