TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

What's a condition system and why do you want one?

35 pointsby uros643about 14 years ago

4 comments

sedachvabout 14 years ago
One thing that hasn't been pointed out is how the Common Lisp condition system provides a sane alternative to the Unix signal(7) brain-damage. To quote the Hyperspec:<p><pre><code> If the condition is not handled, signal returns nil. </code></pre> <a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" rel="nofollow">http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec...</a>
评论 #2495492 未加载
5labout 14 years ago
For Ruby, check out <a href="http://cond.rubyforge.org/" rel="nofollow">http://cond.rubyforge.org/</a>
Groxxabout 14 years ago
Interesting... I was just coming to the conclusion that such a thing would be handy, as so many things use exceptions as a way of, essentially, returning multiple values. It's rampant - add an item to a set where it already exists, and it throws. Which costs a <i>lot</i> compared to returning false due to the stack-unwinding, but is more flexible. Typically though, the stack-unwinding is entirely unnecessary, the class / message is more than enough to determine the source of the problem. And such a thing would turn try/catch blocks into a loosely-coupled implicit delegate system, which strikes me as fantastically useful.
评论 #2497239 未加载
thurnabout 14 years ago
Would this be pretty easy to implement in a language with first class functions (albeit with more boilerplate) just by keeping a list of functions to be invoked before raising an exception?
评论 #2495641 未加载
评论 #2497786 未加载