<?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"
	>
<channel>
	<title>Comments on: &#8220;For&#8221; hack with Option monad in Java</title>
	<atom:link href="http://www.codemonkeyism.com/archives/2008/08/06/for-hack-with-option-monad-in-java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codemonkeyism.com/archives/2008/08/06/for-hack-with-option-monad-in-java/</link>
	<description>Programming is hard</description>
	<pubDate>Thu, 20 Nov 2008 09:50:51 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
		<item>
		<title>By: Recent Links Tagged With "monads" - JabberTags</title>
		<link>http://www.codemonkeyism.com/archives/2008/08/06/for-hack-with-option-monad-in-java/#comment-177214</link>
		<dc:creator>Recent Links Tagged With "monads" - JabberTags</dc:creator>
		<pubDate>Thu, 09 Oct 2008 14:55:06 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/08/06/for-hack-with-option-monad-in-java/#comment-177214</guid>
		<description>[...] links &#62;&#62; monads   functional programming and monads Saved by SailorStarDust on Wed 08-10-2008   “For” hack with Option monad in Java Saved by zonble on Wed 08-10-2008   Arrows generalize monads and idioms Saved by rmventure on Mon [...]</description>
		<content:encoded><![CDATA[<p>[...] links &gt;&gt; monads   functional programming and monads Saved by SailorStarDust on Wed 08-10-2008   “For” hack with Option monad in Java Saved by zonble on Wed 08-10-2008   Arrows generalize monads and idioms Saved by rmventure on Mon [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://www.codemonkeyism.com/archives/2008/08/06/for-hack-with-option-monad-in-java/#comment-154837</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Mon, 25 Aug 2008 10:54:13 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/08/06/for-hack-with-option-monad-in-java/#comment-154837</guid>
		<description>@3bit: You're right. But lots of people use [] in blogs and wikis because they are easier to use with most blogging software than pointy braces.</description>
		<content:encoded><![CDATA[<p>@3bit: You&#8217;re right. But lots of people use [] in blogs and wikis because they are easier to use with most blogging software than pointy braces.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 3bit</title>
		<link>http://www.codemonkeyism.com/archives/2008/08/06/for-hack-with-option-monad-in-java/#comment-154402</link>
		<dc:creator>3bit</dc:creator>
		<pubDate>Sat, 23 Aug 2008 11:22:51 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/08/06/for-hack-with-option-monad-in-java/#comment-154402</guid>
		<description>Am i completely crazy or is the Type Parameter in Java not usually enclosed in ''?  Or is there a deeper meaning behind this? Since I didn't trust myself I tried this code in Java but it would give me errors because of the misplaced array '[' ']' qualifiers...</description>
		<content:encoded><![CDATA[<p>Am i completely crazy or is the Type Parameter in Java not usually enclosed in &#8221;?  Or is there a deeper meaning behind this? Since I didn&#8217;t trust myself I tried this code in Java but it would give me errors because of the misplaced array &#8216;[' ']&#8216; qualifiers&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://www.codemonkeyism.com/archives/2008/08/06/for-hack-with-option-monad-in-java/#comment-147232</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Mon, 11 Aug 2008 08:38:56 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/08/06/for-hack-with-option-monad-in-java/#comment-147232</guid>
		<description>Nice!</description>
		<content:encoded><![CDATA[<p>Nice!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lqd</title>
		<link>http://www.codemonkeyism.com/archives/2008/08/06/for-hack-with-option-monad-in-java/#comment-147201</link>
		<dc:creator>lqd</dc:creator>
		<pubDate>Mon, 11 Aug 2008 07:25:47 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/08/06/for-hack-with-option-monad-in-java/#comment-147201</guid>
		<description>Where i find this could also work is in adapter patterns (see Tim Boudreau's last blog about API and 'Capability pattern' or Eclipse getAdapter/IAdaptable API)

for (CapabilityClass17 cap : getAdapter (CapabilityClass17.class)) {  
    // do something with the extended API  
}

Ironically, if you think your class had to behave like a list, and you add that adapter later, you could actually get some kind of real looking for loop :)

for (Object s : getAdapter (List.class)) {
    // Booya :)
}

As for the type of the iterator, maybe super type tokens can help.</description>
		<content:encoded><![CDATA[<p>Where i find this could also work is in adapter patterns (see Tim Boudreau&#8217;s last blog about API and &#8216;Capability pattern&#8217; or Eclipse getAdapter/IAdaptable API)</p>
<p>for (CapabilityClass17 cap : getAdapter (CapabilityClass17.class)) {<br />
    // do something with the extended API<br />
}</p>
<p>Ironically, if you think your class had to behave like a list, and you add that adapter later, you could actually get some kind of real looking for loop :)</p>
<p>for (Object s : getAdapter (List.class)) {<br />
    // Booya :)<br />
}</p>
<p>As for the type of the iterator, maybe super type tokens can help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://www.codemonkeyism.com/archives/2008/08/06/for-hack-with-option-monad-in-java/#comment-146482</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Sat, 09 Aug 2008 16:08:29 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/08/06/for-hack-with-option-monad-in-java/#comment-146482</guid>
		<description>"Perhaps you should use try to some patterns that are better fit
for Java like Visitor mentioned by James or Null object."

I've read the GoF Book 15 years ago, taught them to lots of students and used them in lots of projects. I think the Null object (though not from the GoF book but from Fowler several years later) is used not often enough. Recently I introduced NullId to a project (with a nice isValid() method) with very good results. More people should do that.

"Search for design partners or GoF."

Search for Refactoring and Fowler for the Null object pattern.

Nonetheless Option/Maybe is something different.</description>
		<content:encoded><![CDATA[<p>&#8220;Perhaps you should use try to some patterns that are better fit<br />
for Java like Visitor mentioned by James or Null object.&#8221;</p>
<p>I&#8217;ve read the GoF Book 15 years ago, taught them to lots of students and used them in lots of projects. I think the Null object (though not from the GoF book but from Fowler several years later) is used not often enough. Recently I introduced NullId to a project (with a nice isValid() method) with very good results. More people should do that.</p>
<p>&#8220;Search for design partners or GoF.&#8221;</p>
<p>Search for Refactoring and Fowler for the Null object pattern.</p>
<p>Nonetheless Option/Maybe is something different.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vjekoslav Nesek</title>
		<link>http://www.codemonkeyism.com/archives/2008/08/06/for-hack-with-option-monad-in-java/#comment-146292</link>
		<dc:creator>Vjekoslav Nesek</dc:creator>
		<pubDate>Sat, 09 Aug 2008 07:50:13 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/08/06/for-hack-with-option-monad-in-java/#comment-146292</guid>
		<description>Jeez, this double loop construct is so much better than

if (x != null &#38;&#38; y != null) {
  return x   y;
}

...and much more readable.

Perhaps you should use try to some patterns that are better fit
for Java like Visitor mentioned by James or Null object. Search
for design partners or GoF.

Don't get me wrong, monads are cool but can't be expressed
in Java at this time. Perhaps if Java7 incorporates closure
proposal, we'll be able to express something like:

withObjectsThatArentNull(x, y) {
  return x   y;
}</description>
		<content:encoded><![CDATA[<p>Jeez, this double loop construct is so much better than</p>
<p>if (x != null &amp;&amp; y != null) {<br />
  return x   y;<br />
}</p>
<p>&#8230;and much more readable.</p>
<p>Perhaps you should use try to some patterns that are better fit<br />
for Java like Visitor mentioned by James or Null object. Search<br />
for design partners or GoF.</p>
<p>Don&#8217;t get me wrong, monads are cool but can&#8217;t be expressed<br />
in Java at this time. Perhaps if Java7 incorporates closure<br />
proposal, we&#8217;ll be able to express something like:</p>
<p>withObjectsThatArentNull(x, y) {<br />
  return x   y;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Response to the critique for my last post and OneElementIterator at Stephans Blog</title>
		<link>http://www.codemonkeyism.com/archives/2008/08/06/for-hack-with-option-monad-in-java/#comment-145948</link>
		<dc:creator>Response to the critique for my last post and OneElementIterator at Stephans Blog</dc:creator>
		<pubDate>Fri, 08 Aug 2008 07:33:17 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/08/06/for-hack-with-option-monad-in-java/#comment-145948</guid>
		<description>[...] Productivity in software development           &#171; &#8220;For&#8221; hack with Option monad in Java [...]</description>
		<content:encoded><![CDATA[<p>[...] Productivity in software development           &laquo; &#8220;For&#8221; hack with Option monad in Java [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://www.codemonkeyism.com/archives/2008/08/06/for-hack-with-option-monad-in-java/#comment-145937</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Fri, 08 Aug 2008 06:52:54 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/08/06/for-hack-with-option-monad-in-java/#comment-145937</guid>
		<description>@James: Thanks a lot.

The double loop is a nice construct. Hats off for thinking of that and the anology to Scala and Haskell with for and do. Especially "for" :-)</description>
		<content:encoded><![CDATA[<p>@James: Thanks a lot.</p>
<p>The double loop is a nice construct. Hats off for thinking of that and the anology to Scala and Haskell with for and do. Especially &#8220;for&#8221; :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Iry</title>
		<link>http://www.codemonkeyism.com/archives/2008/08/06/for-hack-with-option-monad-in-java/#comment-145575</link>
		<dc:creator>James Iry</dc:creator>
		<pubDate>Thu, 07 Aug 2008 16:30:47 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/08/06/for-hack-with-option-monad-in-java/#comment-145575</guid>
		<description>My pluses got eaten in the previous comment. Everywhere you see "x y" read "x plus y".</description>
		<content:encoded><![CDATA[<p>My pluses got eaten in the previous comment. Everywhere you see &#8220;x y&#8221; read &#8220;x plus y&#8221;.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
