<?xml version="1.0" encoding="utf-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Monads by stealth</title>
	<link>http://www.nobugs.org/blog/archives/2004/05/02/monads-by-stealth/</link>
	<description>Thoughts of a software engineer</description>
	<pubDate>Thu, 28 Aug 2008 05:14:32 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: Pavlos</title>
		<link>http://www.nobugs.org/blog/archives/2004/05/02/monads-by-stealth/#comment-73</link>
		<dc:creator>Pavlos</dc:creator>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0000</pubDate>
		<guid>http://www.nobugs.org/blog/archives/2004/05/02/monads-by-stealth/#comment-73</guid>
		<description>I'm not familiar enough with the subject, but I'd like to note that a function is a detriment to clarity that you pay to buy abstraction. In this case, I see the tradeoff as misplaced, but then I'm a dinosaur.

Presumably what you want is not to abstract the program logic but to ensure it is well-formed. I would prefer too see that done with typing of expressions rather than functions, for example by adding an overloaded "maybe" keyword to C++. It's use is made clear by the following example:


  maybe int m;

  maybe (m) {
        // m is in scope as type int
  } else {
        // m is hidden from scope
  }


I did say I was a dinosaur ;-)</description>
		<content:encoded><![CDATA[<p>I&#8217;m not familiar enough with the subject, but I&#8217;d like to note that a function is a detriment to clarity that you pay to buy abstraction. In this case, I see the tradeoff as misplaced, but then I&#8217;m a dinosaur.</p>
<p>Presumably what you want is not to abstract the program logic but to ensure it is well-formed. I would prefer too see that done with typing of expressions rather than functions, for example by adding an overloaded &#8220;maybe&#8221; keyword to C++. It&#8217;s use is made clear by the following example:</p>
<p>  maybe int m;</p>
<p>  maybe (m) {<br />
        // m is in scope as type int<br />
  } else {<br />
        // m is hidden from scope<br />
  }</p>
<p>I did say I was a dinosaur <img src='http://www.nobugs.org/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anthony Bailey</title>
		<link>http://www.nobugs.org/blog/archives/2004/05/02/monads-by-stealth/#comment-74</link>
		<dc:creator>Anthony Bailey</dc:creator>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0000</pubDate>
		<guid>http://www.nobugs.org/blog/archives/2004/05/02/monads-by-stealth/#comment-74</guid>
		<description>(I note that if you come straight to this page, you can't easily see that I commented previously via a TrackBack, so...

"I commented previously in my own blog, which you can get to if you hit the TrackBack link at the foot of Andy's article."

Now on to this comment...)


I note that you can write code with structure much like Pavlos desires by having Maybe&#60;X&#62; implement an implicit cast to X that throws a MaybeIsInvalid exception when the object is invalid. Then you can write

Maybe&#60;int&#62; m;
try {
// use m as if it has type int
} catch MaybeIsInvalid {
// your alternative action
// (m remains in scope, but I'm not sure why it shouldn't, Pavlos - you might want e.g. to assign to it.)
}</description>
		<content:encoded><![CDATA[<p>(I note that if you come straight to this page, you can&#8217;t easily see that I commented previously via a TrackBack, so&#8230;</p>
<p>&#8220;I commented previously in my own blog, which you can get to if you hit the TrackBack link at the foot of Andy&#8217;s article.&#8221;</p>
<p>Now on to this comment&#8230;)</p>
<p>I note that you can write code with structure much like Pavlos desires by having Maybe&lt;X&gt; implement an implicit cast to X that throws a MaybeIsInvalid exception when the object is invalid. Then you can write</p>
<p>Maybe&lt;int&gt; m;<br />
try {<br />
// use m as if it has type int<br />
} catch MaybeIsInvalid {<br />
// your alternative action<br />
// (m remains in scope, but I&#8217;m not sure why it shouldn&#8217;t, Pavlos - you might want e.g. to assign to it.)<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anthony Bailey's blog</title>
		<link>http://www.nobugs.org/blog/archives/2004/05/02/monads-by-stealth/#comment-75</link>
		<dc:creator>Anthony Bailey's blog</dc:creator>
		<pubDate>Thu, 01 Jan 1970 01:00:00 +0000</pubDate>
		<guid>http://www.nobugs.org/blog/archives/2004/05/02/monads-by-stealth/#comment-75</guid>
		<description>&lt;strong&gt;http://anthonybailey.livejournal.com/15867.html&lt;/strong&gt;
Andrew Birkett tries to sneak a monad passed us over on his software engineering blog. [...] I approve of where he's coming from with the whole stealth-abstraction thing [...] yet there's something about the example as presented that I don't like much....
</description>
		<content:encoded><![CDATA[<p><strong><a href="http://anthonybailey.livejournal.com/15867.html" rel="nofollow">http://anthonybailey.livejournal.com/15867.html</a></strong><br />
Andrew Birkett tries to sneak a monad passed us over on his software engineering blog. [&#8230;] I approve of where he&#8217;s coming from with the whole stealth-abstraction thing [&#8230;] yet there&#8217;s something about the example as presented that I don&#8217;t like much&#8230;.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
