<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>
<channel>
	<title>Comments on: Typed Yields: Non fatal exceptions</title>
	<atom:link href="http://blog.affien.com/archives/2006/07/16/typed-yields-non-fatal-exceptions/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.affien.com/archives/2006/07/16/typed-yields-non-fatal-exceptions/</link>
	<description>A few thoughts</description>
	<pubDate>Tue, 06 Jan 2009 06:40:25 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Kaja</title>
		<link>http://blog.affien.com/archives/2006/07/16/typed-yields-non-fatal-exceptions/comment-page-1/#comment-73426</link>
		<dc:creator>Kaja</dc:creator>
		<pubDate>Mon, 17 Jul 2006 19:09:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.w-nz.com/archives/2006/07/16/typed-yields-non-fatal-exceptions/#comment-73426</guid>
		<description>I partially take that back.  The second method still requires more overhead, but it does not necesarily require dynamic memory because the extra overhead could be placed on the stack as it is done in the first method.</description>
		<content:encoded><![CDATA[<p>I partially take that back.  The second method still requires more overhead, but it does not necesarily require dynamic memory because the extra overhead could be placed on the stack as it is done in the first method.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kaja</title>
		<link>http://blog.affien.com/archives/2006/07/16/typed-yields-non-fatal-exceptions/comment-page-1/#comment-73425</link>
		<dc:creator>Kaja</dc:creator>
		<pubDate>Mon, 17 Jul 2006 18:52:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.w-nz.com/archives/2006/07/16/typed-yields-non-fatal-exceptions/#comment-73425</guid>
		<description>Well there's two ways to implement exception handling that I can think of off the top of my head.  Both are very similar.  Neither is perfect.

One method is similar to how I implemented those macros that allowed exceptions in C.  This method required no dynamic memory whatsoever (except maybe allocating the exception itself), but it required a longjmp() for every thrown exception (including the implicit rethrows if not caught by a handler).

The other method is almost the same thing but requires a dynamic list of all the caught exception types for any given "begin" block.  And it can iterate through the list of begin blocks until it find a begin block that catches the exception and does only one longjmp() to the proper begin block.  While this method can find the appropriate rescue/on handler faster than the other method, it requires more dynamic memory.  However, this is not so much of a problem in a language that has a good GC as it would be in C and C++.

And personally, I am not a fan of having to explicitly rethrow.  Based on the way that I program, I think it is more of annoyance than actually helpful (same with Java's "throws" keyword on methods).</description>
		<content:encoded><![CDATA[<p>Well there&#8217;s two ways to implement exception handling that I can think of off the top of my head.  Both are very similar.  Neither is perfect.</p>
<p>One method is similar to how I implemented those macros that allowed exceptions in C.  This method required no dynamic memory whatsoever (except maybe allocating the exception itself), but it required a longjmp() for every thrown exception (including the implicit rethrows if not caught by a handler).</p>
<p>The other method is almost the same thing but requires a dynamic list of all the caught exception types for any given &#8220;begin&#8221; block.  And it can iterate through the list of begin blocks until it find a begin block that catches the exception and does only one longjmp() to the proper begin block.  While this method can find the appropriate rescue/on handler faster than the other method, it requires more dynamic memory.  However, this is not so much of a problem in a language that has a good GC as it would be in C and C++.</p>
<p>And personally, I am not a fan of having to explicitly rethrow.  Based on the way that I program, I think it is more of annoyance than actually helpful (same with Java&#8217;s &#8220;throws&#8221; keyword on methods).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bas Westerbaan</title>
		<link>http://blog.affien.com/archives/2006/07/16/typed-yields-non-fatal-exceptions/comment-page-1/#comment-73423</link>
		<dc:creator>Bas Westerbaan</dc:creator>
		<pubDate>Mon, 17 Jul 2006 16:43:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.w-nz.com/archives/2006/07/16/typed-yields-non-fatal-exceptions/#comment-73423</guid>
		<description>Good point.

I've got two possible solutions:

- Register exception handlers in a look-up-table, then the stack hasn't got to be searched.
- Or, only allow exceptions to travel one frame down in the stack. This is the case with .net -- you need to explicitly rethrow exceptions if you want them to go deeper into the stack.</description>
		<content:encoded><![CDATA[<p>Good point.</p>
<p>I&#8217;ve got two possible solutions:</p>
<p>- Register exception handlers in a look-up-table, then the stack hasn&#8217;t got to be searched.<br />
- Or, only allow exceptions to travel one frame down in the stack. This is the case with .net &#8212; you need to explicitly rethrow exceptions if you want them to go deeper into the stack.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kaja</title>
		<link>http://blog.affien.com/archives/2006/07/16/typed-yields-non-fatal-exceptions/comment-page-1/#comment-73422</link>
		<dc:creator>Kaja</dc:creator>
		<pubDate>Mon, 17 Jul 2006 16:38:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.w-nz.com/archives/2006/07/16/typed-yields-non-fatal-exceptions/#comment-73422</guid>
		<description>At first, this sounded well enough and good.  But there is a problem with having a lot of warnings/messages being thrown in a block of code.  Because if a program chooses to ignore those warnings (ie. not specifically define an "on" block that can catch it), it must make its way back through all the exception handlers currently on the stack before the exception can be caught at the top level and probably just disregarded.  This is quite expensive for a simple warning that the user doesnt even care about enough to catch.</description>
		<content:encoded><![CDATA[<p>At first, this sounded well enough and good.  But there is a problem with having a lot of warnings/messages being thrown in a block of code.  Because if a program chooses to ignore those warnings (ie. not specifically define an &#8220;on&#8221; block that can catch it), it must make its way back through all the exception handlers currently on the stack before the exception can be caught at the top level and probably just disregarded.  This is quite expensive for a simple warning that the user doesnt even care about enough to catch.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bas Westerbaan</title>
		<link>http://blog.affien.com/archives/2006/07/16/typed-yields-non-fatal-exceptions/comment-page-1/#comment-73414</link>
		<dc:creator>Bas Westerbaan</dc:creator>
		<pubDate>Mon, 17 Jul 2006 05:39:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.w-nz.com/archives/2006/07/16/typed-yields-non-fatal-exceptions/#comment-73414</guid>
		<description>Yes, that is how it works. It may seem odd, but I think it is cleaner than using a 'messages list' or callback delegate or yield to do similar stuff.</description>
		<content:encoded><![CDATA[<p>Yes, that is how it works. It may seem odd, but I think it is cleaner than using a &#8216;messages list&#8217; or callback delegate or yield to do similar stuff.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zef</title>
		<link>http://blog.affien.com/archives/2006/07/16/typed-yields-non-fatal-exceptions/comment-page-1/#comment-73407</link>
		<dc:creator>Zef</dc:creator>
		<pubDate>Sun, 16 Jul 2006 19:40:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.w-nz.com/archives/2006/07/16/typed-yields-non-fatal-exceptions/#comment-73407</guid>
		<description>Do I understand well that if such a non-fatal exception occurs the code in the begin block will keep executing and is just interrupted by the execution of the "on" block? Isn't that a bit odd, jumping around in the code like that? Catching an exception in a block in natural, the execution in the try/begin block is aborted and continues in the catch, but here it doesn't. Here's it's just interrupted by the execution of the on block and then continues.</description>
		<content:encoded><![CDATA[<p>Do I understand well that if such a non-fatal exception occurs the code in the begin block will keep executing and is just interrupted by the execution of the &#8220;on&#8221; block? Isn&#8217;t that a bit odd, jumping around in the code like that? Catching an exception in a block in natural, the execution in the try/begin block is aborted and continues in the catch, but here it doesn&#8217;t. Here&#8217;s it&#8217;s just interrupted by the execution of the on block and then continues.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
