Re: Readability of exception handling

Parker Jones <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
> From: [email protected]
> 
> catch(my_function(A,B,C), 
>          my_exception(D), 
>         ( writeln(my_exception(D)), 
>           fail).
> 
> my_function(_,_,C) :- throw(my_exception(C)).

Thanks for the reply, Alan.  But that is one handler that catches only one exception. What about exception_1 with handler_1, exception_2 with handler_2,...?  Does that have a flat structure or does it require nesting?



>  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
> _______________________________________________
> SWI-Prolog mailing list
> [email protected]
> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog
 		 	   		  
-------------- next part --------------
HTML attachment scrubbed and removed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.