<?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 for Labix Blog</title>
	<atom:link href="http://blog.labix.org/comments/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.labix.org</link>
	<description>by Gustavo Niemeyer</description>
	<lastBuildDate>Fri, 26 Apr 2013 18:21:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>Comment on Exceptional crashes by Evan Jones</title>
		<link>http://blog.labix.org/2013/04/23/exceptional-crashes#comment-1796</link>
		<dc:creator>Evan Jones</dc:creator>
		<pubDate>Fri, 26 Apr 2013 18:21:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.labix.org/?p=1330#comment-1796</guid>
		<description><![CDATA[I think like many software engineering issues, there are (at least) two sides here, with fundamental tradeoffs. Error handling is one of the &quot;hard problems&quot; in software.

My (admittedly limited) personal experience with writing some Go programs is that I *want* to crash on the first error by default, since I almost never know what the right thing to do is, at least not the first time I&#039;m writing something. I&#039;ve written my own &quot;assert-like&quot; function that panics to make this easier to implement (asserts are a different debate).

However, I also agree that to make something more robust and reliable, you want to handle errors correctly. I do think that making recoverable errors more explicitly visible is good, and that Go&#039;s mechanism seems to result it slightly less pain than checked exceptions.

I do wish there was an easier way for me to get the &quot;crash on error&quot; behavior I want though. I also agree with James Henstridge: when you have &quot;chained&quot; errors, having a stack trace would make it easier to track down the ultimate source of the error.]]></description>
		<content:encoded><![CDATA[<p>I think like many software engineering issues, there are (at least) two sides here, with fundamental tradeoffs. Error handling is one of the &#8220;hard problems&#8221; in software.</p>
<p>My (admittedly limited) personal experience with writing some Go programs is that I *want* to crash on the first error by default, since I almost never know what the right thing to do is, at least not the first time I&#8217;m writing something. I&#8217;ve written my own &#8220;assert-like&#8221; function that panics to make this easier to implement (asserts are a different debate).</p>
<p>However, I also agree that to make something more robust and reliable, you want to handle errors correctly. I do think that making recoverable errors more explicitly visible is good, and that Go&#8217;s mechanism seems to result it slightly less pain than checked exceptions.</p>
<p>I do wish there was an easier way for me to get the &#8220;crash on error&#8221; behavior I want though. I also agree with James Henstridge: when you have &#8220;chained&#8221; errors, having a stack trace would make it easier to track down the ultimate source of the error.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Exceptional crashes by niemeyer</title>
		<link>http://blog.labix.org/2013/04/23/exceptional-crashes#comment-1780</link>
		<dc:creator>niemeyer</dc:creator>
		<pubDate>Wed, 24 Apr 2013 20:08:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.labix.org/?p=1330#comment-1780</guid>
		<description><![CDATA[&lt;i&gt;&gt; In some, (like Java) your code won’t compile if you don’t handle the appropriate exceptions.&lt;/i&gt;

Please see comments above.]]></description>
		<content:encoded><![CDATA[<p><i>&gt; In some, (like Java) your code won’t compile if you don’t handle the appropriate exceptions.</i></p>
<p>Please see comments above.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Exceptional crashes by Peter Recore</title>
		<link>http://blog.labix.org/2013/04/23/exceptional-crashes#comment-1779</link>
		<dc:creator>Peter Recore</dc:creator>
		<pubDate>Wed, 24 Apr 2013 20:01:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.labix.org/?p=1330#comment-1779</guid>
		<description><![CDATA[This is not strictly about Exceptions vs error codes.  Not all languages allow you to ignore exceptions like Python does.  In some, (like Java) your code won&#039;t compile if you don&#039;t handle the appropriate exceptions.  In the example:
&gt; close_nuclear_bunker()
&gt; set_off_the_bomb()
If you didn&#039;t catch &quot;DoorJammedException&quot; somewhere, your code won&#039;t compile.]]></description>
		<content:encoded><![CDATA[<p>This is not strictly about Exceptions vs error codes.  Not all languages allow you to ignore exceptions like Python does.  In some, (like Java) your code won&#8217;t compile if you don&#8217;t handle the appropriate exceptions.  In the example:<br />
&gt; close_nuclear_bunker()<br />
&gt; set_off_the_bomb()<br />
If you didn&#8217;t catch &#8220;DoorJammedException&#8221; somewhere, your code won&#8217;t compile.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Exceptional crashes by Anoop</title>
		<link>http://blog.labix.org/2013/04/23/exceptional-crashes#comment-1772</link>
		<dc:creator>Anoop</dc:creator>
		<pubDate>Wed, 24 Apr 2013 12:23:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.labix.org/?p=1330#comment-1772</guid>
		<description><![CDATA[Good post. 

Having used C++/Java/Python for networking software (shipped as appliances) and cloud hosted services, what I have felt is that for small scripts where special error handling is not required the &quot;parachute exception&quot; is ok.

But for any serious long running software GO&#039;s error handling seems to be the right one though it may appear slightly verbose. It is really good that the GO apis clearly tells if a particular function will fail or not and encourages to handle it. Many times I miss this in python and have the experience of process crashing(and forced to do blind try:except: blocks at top level). Temporary -ve  cases are pretty common in most networking software and will need to be handled at right place.The reason why appliance based software is stressed in the comment is because applying a fix to a 100 customers is not an easy and pleasant task. So an error handling paradigm (like GO) which forces programmer to think/handle at the place where it happens is the right choice.]]></description>
		<content:encoded><![CDATA[<p>Good post. </p>
<p>Having used C++/Java/Python for networking software (shipped as appliances) and cloud hosted services, what I have felt is that for small scripts where special error handling is not required the &#8220;parachute exception&#8221; is ok.</p>
<p>But for any serious long running software GO&#8217;s error handling seems to be the right one though it may appear slightly verbose. It is really good that the GO apis clearly tells if a particular function will fail or not and encourages to handle it. Many times I miss this in python and have the experience of process crashing(and forced to do blind try:except: blocks at top level). Temporary -ve  cases are pretty common in most networking software and will need to be handled at right place.The reason why appliance based software is stressed in the comment is because applying a fix to a 100 customers is not an easy and pleasant task. So an error handling paradigm (like GO) which forces programmer to think/handle at the place where it happens is the right choice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Exceptional crashes by niemeyer</title>
		<link>http://blog.labix.org/2013/04/23/exceptional-crashes#comment-1775</link>
		<dc:creator>niemeyer</dc:creator>
		<pubDate>Wed, 24 Apr 2013 11:50:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.labix.org/?p=1330#comment-1775</guid>
		<description><![CDATA[&lt;i&gt;&gt; I’m making the same argument as many have done before:
&gt;
&gt; close_nuclear_bunker()
&gt; set_off_the_bomb()&lt;/i&gt;

That&#039;s very obviously broken code if you&#039;re using an error result, and any code review would catch it even if the programmers (which should be fired in this specific case) left it off. Now, as described in the post, the curious thing is that I cannot tell if this is correct or not if it&#039;s using exceptions. If I get an exception out of set_off_the_bomb, was the error handled internally to prevent collateral damage, or was it overlooked as the examples in the post demonstrate? The common practice of fixing lack of error handling once an exception shows would go pretty poorly.

All of this goes back to the points in the post: the advantage isn&#039;t that Go forces you to do anything. Bad programmers can do bad programming on any language and any error handling style. The point is that the conventions established encourage keeping the error path in mind, and that does make a great deal of a difference in practice when people are actually trying to do a good job, which is my reality.

&lt;i&gt;&gt; C is also famous for crashing in unpredictable ways with horrendously unclear error messages. And everybody who’s had a Go program with 10 goroutines crash on them knows that Go shares this characteristic too.&lt;/i&gt;

Go actually shows a very clean traceback for all the 10 goroutines when it does so, in a much better fashion than any concurrent programming I&#039;ve done before that I can remember.

&lt;i&gt;&gt; Also, it just happens to be the simple solution (...) C/Go-style error handling is much, much easier to compile than exceptions. Every line of Go code with very few exceptions can lead to OOM error and there’s things like divide by zero and such).&lt;/i&gt;

These are truly exceptional situations and are handled as panics which work similarly to exceptions, and can be recovered from, although that&#039;s of course rarely effective for cases such as OOM. This also kills the &quot;they did it like that because it&#039;s simple&quot; argument. It does have an exception-like mechanism, and it&#039;s consciously not used for non-exceptional things for good reasons.

&lt;i&gt;&gt; Until then, can we please stop claiming that making programs continue on encountering error conditions somehow improves programmers ? Because it’s ridiculous.&lt;/i&gt;

This is ridiculous indeed, and you&#039;re the first one to mention it.]]></description>
		<content:encoded><![CDATA[<p><i>&gt; I’m making the same argument as many have done before:<br />
&gt;<br />
&gt; close_nuclear_bunker()<br />
&gt; set_off_the_bomb()</i></p>
<p>That&#8217;s very obviously broken code if you&#8217;re using an error result, and any code review would catch it even if the programmers (which should be fired in this specific case) left it off. Now, as described in the post, the curious thing is that I cannot tell if this is correct or not if it&#8217;s using exceptions. If I get an exception out of set_off_the_bomb, was the error handled internally to prevent collateral damage, or was it overlooked as the examples in the post demonstrate? The common practice of fixing lack of error handling once an exception shows would go pretty poorly.</p>
<p>All of this goes back to the points in the post: the advantage isn&#8217;t that Go forces you to do anything. Bad programmers can do bad programming on any language and any error handling style. The point is that the conventions established encourage keeping the error path in mind, and that does make a great deal of a difference in practice when people are actually trying to do a good job, which is my reality.</p>
<p><i>&gt; C is also famous for crashing in unpredictable ways with horrendously unclear error messages. And everybody who’s had a Go program with 10 goroutines crash on them knows that Go shares this characteristic too.</i></p>
<p>Go actually shows a very clean traceback for all the 10 goroutines when it does so, in a much better fashion than any concurrent programming I&#8217;ve done before that I can remember.</p>
<p><i>&gt; Also, it just happens to be the simple solution (&#8230;) C/Go-style error handling is much, much easier to compile than exceptions. Every line of Go code with very few exceptions can lead to OOM error and there’s things like divide by zero and such).</i></p>
<p>These are truly exceptional situations and are handled as panics which work similarly to exceptions, and can be recovered from, although that&#8217;s of course rarely effective for cases such as OOM. This also kills the &#8220;they did it like that because it&#8217;s simple&#8221; argument. It does have an exception-like mechanism, and it&#8217;s consciously not used for non-exceptional things for good reasons.</p>
<p><i>&gt; Until then, can we please stop claiming that making programs continue on encountering error conditions somehow improves programmers ? Because it’s ridiculous.</i></p>
<p>This is ridiculous indeed, and you&#8217;re the first one to mention it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Exceptional crashes by oelewapperke</title>
		<link>http://blog.labix.org/2013/04/23/exceptional-crashes#comment-1769</link>
		<dc:creator>oelewapperke</dc:creator>
		<pubDate>Wed, 24 Apr 2013 11:13:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.labix.org/?p=1330#comment-1769</guid>
		<description><![CDATA[The elephant in the room here is that of course Go doesn&#039;t require correct error handling. Ignoring return codes is perfectly valid in Go. 

For a test for how your own error handling is, take your nearest Go program code that opens a socket. Any socket. Counter the number of different error handling paths, do you switch between v4 and v6 (and back in the case of a v6 lookup returning a mapped v4 address ?). Count the number of paths through that code. Is it less than 8 ? Sorry to tell you, but you don&#039;t handle errors correctly. When opening a listening socket, you are properly switching it to a dual-stack socket in all cases, right ?

(if you&#039;re interested: read why : http://long.ccaba.upc.edu/long/045Guidelines/eva/ipv6.html#guidelines )

Go doesn&#039;t improve bad programmers who don&#039;t have time to consider all the options. That&#039;s impossible, it&#039;s just partly masked by the fact that mostly only good programmers currently know Go. That&#039;s either going to change (Go succeeds), or not (Go fails to gain traction).

Then the Go error handling will merely have switched everyone&#039;s code from &quot;on error, abort in a recoverable manner&quot;, to &quot;on error continue&quot;.

I&#039;m making the same argument as many have done before:

close_nuclear_bunker()
set_off_the_bomb()

In most cases, recoverable abort (ie. exceptions) is the correct course of action, and this all just sounds like an excuse to bring back a C-ism (because I don&#039;t find the &quot;programmers will consider errors if we make them put them in a variable !&quot; convincing, and I&#039;m pretty sure people like the Go authors don&#039;t find it convincing either). Also, it just happens to be the simple solution (because for a compiler the situation is reversed, C/Go-style error handling is much, much easier to compile than exceptions, for obvious reasons. Both languages, of course, found that they did have to implement at least 2 exception types, both introduced that later on. Every line of Go code with very few exceptions can lead to OOM error and there&#039;s things like divide by zero and such).

C is famous for having extremely brittle programs, and rightfully so. Bringing it&#039;s error-handling style back is not a good thing. C is also famous for crashing in unpredictable ways with horrendously unclear error messages. And everybody who&#039;s had a Go program with 10 goroutines crash on them knows that Go shares this characteristic too.

It is a matter of time till Go shares C&#039;s reputation. Or it could fail entirely I guess. I&#039;d prefer it to succeed.

Until then, can we please stop claiming that making programs continue on encountering error conditions somehow improves programmers ? Because it&#039;s ridiculous.]]></description>
		<content:encoded><![CDATA[<p>The elephant in the room here is that of course Go doesn&#8217;t require correct error handling. Ignoring return codes is perfectly valid in Go. </p>
<p>For a test for how your own error handling is, take your nearest Go program code that opens a socket. Any socket. Counter the number of different error handling paths, do you switch between v4 and v6 (and back in the case of a v6 lookup returning a mapped v4 address ?). Count the number of paths through that code. Is it less than 8 ? Sorry to tell you, but you don&#8217;t handle errors correctly. When opening a listening socket, you are properly switching it to a dual-stack socket in all cases, right ?</p>
<p>(if you&#8217;re interested: read why : <a href="http://long.ccaba.upc.edu/long/045Guidelines/eva/ipv6.html#guidelines" rel="nofollow">http://long.ccaba.upc.edu/long/045Guidelines/eva/ipv6.html#guidelines</a> )</p>
<p>Go doesn&#8217;t improve bad programmers who don&#8217;t have time to consider all the options. That&#8217;s impossible, it&#8217;s just partly masked by the fact that mostly only good programmers currently know Go. That&#8217;s either going to change (Go succeeds), or not (Go fails to gain traction).</p>
<p>Then the Go error handling will merely have switched everyone&#8217;s code from &#8220;on error, abort in a recoverable manner&#8221;, to &#8220;on error continue&#8221;.</p>
<p>I&#8217;m making the same argument as many have done before:</p>
<p>close_nuclear_bunker()<br />
set_off_the_bomb()</p>
<p>In most cases, recoverable abort (ie. exceptions) is the correct course of action, and this all just sounds like an excuse to bring back a C-ism (because I don&#8217;t find the &#8220;programmers will consider errors if we make them put them in a variable !&#8221; convincing, and I&#8217;m pretty sure people like the Go authors don&#8217;t find it convincing either). Also, it just happens to be the simple solution (because for a compiler the situation is reversed, C/Go-style error handling is much, much easier to compile than exceptions, for obvious reasons. Both languages, of course, found that they did have to implement at least 2 exception types, both introduced that later on. Every line of Go code with very few exceptions can lead to OOM error and there&#8217;s things like divide by zero and such).</p>
<p>C is famous for having extremely brittle programs, and rightfully so. Bringing it&#8217;s error-handling style back is not a good thing. C is also famous for crashing in unpredictable ways with horrendously unclear error messages. And everybody who&#8217;s had a Go program with 10 goroutines crash on them knows that Go shares this characteristic too.</p>
<p>It is a matter of time till Go shares C&#8217;s reputation. Or it could fail entirely I guess. I&#8217;d prefer it to succeed.</p>
<p>Until then, can we please stop claiming that making programs continue on encountering error conditions somehow improves programmers ? Because it&#8217;s ridiculous.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Exceptional crashes by Exceptional crashes &#124; thoughts...</title>
		<link>http://blog.labix.org/2013/04/23/exceptional-crashes#comment-1767</link>
		<dc:creator>Exceptional crashes &#124; thoughts...</dc:creator>
		<pubDate>Wed, 24 Apr 2013 10:45:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.labix.org/?p=1330#comment-1767</guid>
		<description><![CDATA[[...] http://blog.labix.org/2013/04/23/exceptional-crashes [...]]]></description>
		<content:encoded><![CDATA[<p>[...] <a href="http://blog.labix.org/2013/04/23/exceptional-crashes" rel="nofollow">http://blog.labix.org/2013/04/23/exceptional-crashes</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Exceptional crashes by niemeyer</title>
		<link>http://blog.labix.org/2013/04/23/exceptional-crashes#comment-1765</link>
		<dc:creator>niemeyer</dc:creator>
		<pubDate>Wed, 24 Apr 2013 03:52:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.labix.org/?p=1330#comment-1765</guid>
		<description><![CDATA[Whenever you call onto a third party package that lacks proper error reporting, it&#039;s easy to fix that yourself by putting better context on what happened.

As a bonus point, the *user* ends up knowing what actually happened as well, which is often not the case when we throw a traceback at them, let alone if the error message is bad such as the regular expression example.

I agree, though. It&#039;s not a clear win on either side.]]></description>
		<content:encoded><![CDATA[<p>Whenever you call onto a third party package that lacks proper error reporting, it&#8217;s easy to fix that yourself by putting better context on what happened.</p>
<p>As a bonus point, the *user* ends up knowing what actually happened as well, which is often not the case when we throw a traceback at them, let alone if the error message is bad such as the regular expression example.</p>
<p>I agree, though. It&#8217;s not a clear win on either side.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Exceptional crashes by James Henstridge</title>
		<link>http://blog.labix.org/2013/04/23/exceptional-crashes#comment-1764</link>
		<dc:creator>James Henstridge</dc:creator>
		<pubDate>Wed, 24 Apr 2013 03:41:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.labix.org/?p=1330#comment-1764</guid>
		<description><![CDATA[Right.  I understand I can provide richer information in my Go errors: but that doesn&#039;t help if none of the third party code I rely on does it too.

It&#039;d be a shame if the answer was to use panic everywhere because it is easier to debug :-)

As far as the regexp error goes, the quality of the error message seems to differ package by package in both Go and Python.  In your example, you&#039;ve also thrown away the information that this is a regular expression error (i.e. the exception&#039;s type is re.error), which would be apparent if it was left uncaught, or if you were using a more constrained &quot;except&quot; clause.]]></description>
		<content:encoded><![CDATA[<p>Right.  I understand I can provide richer information in my Go errors: but that doesn&#8217;t help if none of the third party code I rely on does it too.</p>
<p>It&#8217;d be a shame if the answer was to use panic everywhere because it is easier to debug <img src='http://blog.labix.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>As far as the regexp error goes, the quality of the error message seems to differ package by package in both Go and Python.  In your example, you&#8217;ve also thrown away the information that this is a regular expression error (i.e. the exception&#8217;s type is re.error), which would be apparent if it was left uncaught, or if you were using a more constrained &#8220;except&#8221; clause.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Exceptional crashes by niemeyer</title>
		<link>http://blog.labix.org/2013/04/23/exceptional-crashes#comment-1763</link>
		<dc:creator>niemeyer</dc:creator>
		<pubDate>Wed, 24 Apr 2013 03:24:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.labix.org/?p=1330#comment-1763</guid>
		<description><![CDATA[Go has tracebacks for panics, but not for normal errors, unless you embed them yourself (see Stack in runtime/debug), you won&#039;t get them, which indeed may make bugs a bit harder to debug in some cases, specially on poor error messages. The counterpoint, though, is that errors tend to be more descriptive of the issues that are actually going on. As a simple example:

&lt;code&gt;
&gt;&gt;&gt; try: re.compile(&quot;)(&quot;)
... except Exception as e: print e
... 
unbalanced parenthesis
&lt;/code&gt;

&lt;code&gt;
m, err := regexp.MatchString(&quot;)(&quot;, &quot;foo&quot;)
if err != nil {
&#160;&#160;&#160;&#160;fmt.Println(err)
}
error parsing regexp: unexpected ): `)(`
&lt;/code&gt;]]></description>
		<content:encoded><![CDATA[<p>Go has tracebacks for panics, but not for normal errors, unless you embed them yourself (see Stack in runtime/debug), you won&#8217;t get them, which indeed may make bugs a bit harder to debug in some cases, specially on poor error messages. The counterpoint, though, is that errors tend to be more descriptive of the issues that are actually going on. As a simple example:</p>
<p><code><br />
&gt;&gt;&gt; try: re.compile(")(")<br />
... except Exception as e: print e<br />
...<br />
unbalanced parenthesis<br />
</code></p>
<p><code><br />
m, err := regexp.MatchString(")(", "foo")<br />
if err != nil {<br />
&nbsp;&nbsp;&nbsp;&nbsp;fmt.Println(err)<br />
}<br />
error parsing regexp: unexpected ): `)(`<br />
</code></p>
]]></content:encoded>
	</item>
</channel>
</rss>
