<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Intrepid Blog &#187; yield</title>
	<atom:link href="http://blog.affien.com/archives/tag/yield/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.affien.com</link>
	<description>A few thoughts</description>
	<lastBuildDate>Mon, 23 Jan 2012 08:47:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Typed Yields: Non fatal exceptions</title>
		<link>http://blog.affien.com/archives/2006/07/16/typed-yields-non-fatal-exceptions/</link>
		<comments>http://blog.affien.com/archives/2006/07/16/typed-yields-non-fatal-exceptions/#comments</comments>
		<pubDate>Sun, 16 Jul 2006 16:50:23 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[Intermediate Languages]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[px]]></category>
		<category><![CDATA[semantics]]></category>
		<category><![CDATA[yield]]></category>

		<guid isPermaLink="false">http://blog.w-nz.com/archives/2006/07/16/typed-yields-non-fatal-exceptions/</guid>
		<description><![CDATA[Wouldn't it be nice to have:

begin {
&nsbr;LoadTheD [...]]]></description>
			<content:encoded><![CDATA[<p>Wouldn&#8217;t it be nice to have:</p>
<p><code>begin {<br />
&nsbr;LoadTheDatabase("foo.bar");<br />
} rescue (Exception e) {<br />
&#x0020;print "Fatal exception happened: ", e<br />
} on (Warning w) {<br />
&#x0020;print "Database Warning: ", w<br />
} on (Message m) {<br />
&#x0020;print "Database Message: ", m<br />
}</code></p>
<p>The <code>rescue (Exception e)</code> should be familiar with everyone &#8212; something failed, maybe the database file was corrupted very bad, and raised an exception and the <code>rescue</code> block will be executed.</p>
<p>But what if the database has a small error, or something is only a little bit out of place. You wouldn&#8217;t want to just ignore it, but warn about it. Usually one would implement a &#8216;Logger&#8217; class to which a function can log certain events, but that is ugly and inconvenient.</p>
<p>Enter <em>non fatal exceptions</em>. Basically there would be two ways to raise an exception, fatal like we all know it, and non fatal. When the <code>on</code> block for a non fatal exception has been executed, control will be returned to the function in which the <code>raise</code> was called.</p>
<p>This is done in about the same ways as a lot of languages implement <code>yield</code>. But this time the handling code depends on the type of the yielded object.</p>
<p>As far as Kaja and I concern this will be a feature of Paradox.</p>
<p>Thanks go to Bram for the idea.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2006/07/16/typed-yields-non-fatal-exceptions/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

