[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-janitors] Re: #416: Make stock errors more usable programmatica
From: |
Chicken Trac |
Subject: |
[Chicken-janitors] Re: #416: Make stock errors more usable programmatically |
Date: |
Wed, 22 Dec 2010 15:17:02 -0000 |
#416: Make stock errors more usable programmatically
-----------------------------+----------------------------------------------
Reporter: syn | Owner:
Type: enhancement | Status: closed
Priority: minor | Milestone: 4.7.0
Component: core libraries | Version: 4.6.x
Resolution: wontfix | Keywords:
-----------------------------+----------------------------------------------
Comment(by syn):
Replying to [comment:8 felix]:
> This just leads to programming by accident. Try to avoid errors instead
of using exception-handling as a substitution for control-flow.
Well, I think it's a question of how anal one is about certain kinds of
problems. Say you have a program that can either load some cached state
from a file if it exists or otherwise calculate it live. AFAIU your
suggestion, one should do something like {{{ (when (file-exists? "cache")
(set! state (with-input-from-file "cache" read-state))) }}} and I would
generally agree, mostly for stylistic reasons. However we now have
introduced a race condition into our program: Should the file disappear
between checking for its existence and reading it, it will fail although
it could perfectly continue without loading the file. This means we would
probably want to catch ENOENT errors but still fail on others (thus my
initial request for more specific errors). If we do that though we don't
really need the {{{file-exists?}}} call anymore, it is actually redundant
with catching the error. Granted, this is a contrived example but I think
it is an example of a more general class of problems. Feel free to
disagree, of course, I'm not entirely committed to this either :-)
--
Ticket URL: <http://bugs.call-cc.org/ticket/416#comment:9>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.
- [Chicken-janitors] Re: #416: Make stock errors more usable programmatically, Chicken Trac, 2010/12/01
- [Chicken-janitors] Re: #416: Make stock errors more usable programmatically, Chicken Trac, 2010/12/01
- [Chicken-janitors] Re: #416: Make stock errors more usable programmatically, Chicken Trac, 2010/12/01
- [Chicken-janitors] Re: #416: Make stock errors more usable programmatically, Chicken Trac, 2010/12/01
- [Chicken-janitors] Re: #416: Make stock errors more usable programmatically, Chicken Trac, 2010/12/01
- [Chicken-janitors] Re: #416: Make stock errors more usable programmatically, Chicken Trac, 2010/12/18
- [Chicken-janitors] Re: #416: Make stock errors more usable programmatically,
Chicken Trac <=