<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>Phil Dawes' Stuff - Latest Comments in Lisp conditions - more powerful than exceptions</title><link>http://phildawesstuff.disqus.com/</link><description></description><language>en</language><lastBuildDate>Tue, 27 Jun 2006 09:41:55 -0000</lastBuildDate><item><title>Re: Lisp conditions - more powerful than exceptions</title><link>http://www.phildawes.net/blog/2006/06/26/lisp-conditions-more-powerful-than-exceptions/#comment-2753375</link><description>Hi James,&lt;br&gt;&lt;br&gt;The caller knows what to do because it has requirements it wants to fulfill. If you want a parser that silently ignores the errors you write an exception handler that invokes the 'skip-line' restart. If you want to log you do that etc..&lt;br&gt;&lt;br&gt;This problem is certainly solvable in other ways - you could implement an error callback, or maybe an abstract base class or strategy pattern or something. AFAICS the benefit of the condition system is that it's quick and easy to do the right thing upfront - you defer the error conditions to the caller, who is more likely to know what it wants to do and can change later.&lt;br&gt;&lt;br&gt;E.g. If I'm writing a parse function in python/java I don't think 'this should be an abstract base class because I might want to reuse it in other circumstances later' - I just write and test the function (simplest thing).&lt;br&gt;Then when the program wants to ignore unparseable lines I might add a flag-argument to the function. Finally I might refactor it into a class structure later when I need to use it in other systems. &lt;br&gt;With conditions I just add the resume points to the function - the refactoring is small and idiomatic.&lt;br&gt;&lt;br&gt;(btw, it's early days for me and common lisp, so I don't have any practical experience of how well this works)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Phil Dawes</dc:creator><pubDate>Tue, 27 Jun 2006 09:41:55 -0000</pubDate></item><item><title>Re: Lisp conditions - more powerful than exceptions</title><link>http://www.phildawes.net/blog/2006/06/26/lisp-conditions-more-powerful-than-exceptions/#comment-2753374</link><description>Hmm.  It seems as though there's a danger here of leaking information outside the called method.  If I call the parse file method, how do I as the caller know what to do if there's a problem parsing the document?  If I'm expected to know that, then you can just make that feature part of the API - "I'll call you back when there's a problem parsing the file".  Perhaps I'm missing something but I'm not sure that this doesn't solve a problem that soluble in other ways.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">James Langley</dc:creator><pubDate>Tue, 27 Jun 2006 06:07:53 -0000</pubDate></item></channel></rss>