<?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: Closures and the return of the return</title>
	<atom:link href="http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/feed/" rel="self" type="application/rss+xml" />
	<link>http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/</link>
	<description>Peter Maas's Weblog</description>
	<pubDate>Thu, 16 Oct 2008 02:25:32 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: nmgafter</title>
		<link>http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/#comment-12515</link>
		<dc:creator>nmgafter</dc:creator>
		<pubDate>Sat, 22 Dec 2007 00:11:40 +0000</pubDate>
		<guid isPermaLink="false">http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/#comment-12515</guid>
		<description>@peter Also see &lt;a href="http://gafter.blogspot.com/2007/03/closures-for-organizing-your-code.html" rel="nofollow"&gt;http://gafter.blogspot.com/2007/03/closures-for-organizing-your-code.html&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>@peter Also see <a href="http://gafter.blogspot.com/2007/03/closures-for-organizing-your-code.html" rel="nofollow">http://gafter.blogspot.com/2007/03/closures-for-organizing-your-code.html</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nmgafter</title>
		<link>http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/#comment-12514</link>
		<dc:creator>nmgafter</dc:creator>
		<pubDate>Sat, 22 Dec 2007 00:03:24 +0000</pubDate>
		<guid isPermaLink="false">http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/#comment-12514</guid>
		<description>@peter One example of a use case would be writing an API acts as a typeswitch. Being able to "return" from the enclosing method is just as useful in a typeswitch as it is in any other kind of switch.</description>
		<content:encoded><![CDATA[<p>@peter One example of a use case would be writing an API acts as a typeswitch. Being able to &#8220;return&#8221; from the enclosing method is just as useful in a typeswitch as it is in any other kind of switch.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/#comment-12512</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Fri, 21 Dec 2007 23:16:06 +0000</pubDate>
		<guid isPermaLink="false">http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/#comment-12512</guid>
		<description>@nmgafter I read the paragraph about the implicit behavior of function written using =&#62;  and it makes sense. I'm not to sure if having a different token for non restricted would however be a good idea...? Why would you actually want to allow non-local returns, I personally can't think of a good case?</description>
		<content:encoded><![CDATA[<p>@nmgafter I read the paragraph about the implicit behavior of function written using =&gt;  and it makes sense. I&#8217;m not to sure if having a different token for non restricted would however be a good idea&#8230;? Why would you actually want to allow non-local returns, I personally can&#8217;t think of a good case?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nmgafter</title>
		<link>http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/#comment-12511</link>
		<dc:creator>nmgafter</dc:creator>
		<pubDate>Fri, 21 Dec 2007 23:03:13 +0000</pubDate>
		<guid isPermaLink="false">http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/#comment-12511</guid>
		<description>Actually, I do not expect to support intersection types. Quite simply, when you write a function type using =&#62; or a closure using =&#62; it is restricted, and you can't write a "return" inside the closure.</description>
		<content:encoded><![CDATA[<p>Actually, I do not expect to support intersection types. Quite simply, when you write a function type using =&gt; or a closure using =&gt; it is restricted, and you can&#8217;t write a &#8220;return&#8221; inside the closure.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/#comment-12510</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Fri, 21 Dec 2007 22:58:53 +0000</pubDate>
		<guid isPermaLink="false">http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/#comment-12510</guid>
		<description>The &lt;a href="http://www.javac.info/closures-v05.html" rel="nofollow"&gt;closures-v05&lt;/a&gt; document is quite scarce on details concerning the RestrictedInterface. The blog post on Neals' blog is a better read to understand it. 

I do however feel that this sort of behavior should be intuitive and having different types of closures doesn't really help IMHO. Also, the solution using intersection makes method definitions far to complex! Say we also want to specify the fact that the block passed to the function might thrown an exception; we would get something like this: 

&lt;pre&gt;
public &#60;U,V,throws E extends Exception&#62; ParallelArray&#60;V&#62; 
	combine(ParallelArray&#60;U&#62; other, {T,U=&#62;V throws E}&#038;RestrictedFunction combiner) throws E{ ... }
&lt;/pre&gt;

Which is just ugly. And contrived example or not... people &lt;em&gt;WILL&lt;/em&gt; start doing this!</description>
		<content:encoded><![CDATA[<p>The <a href="http://www.javac.info/closures-v05.html" rel="nofollow">closures-v05</a> document is quite scarce on details concerning the RestrictedInterface. The blog post on Neals&#8217; blog is a better read to understand it. </p>
<p>I do however feel that this sort of behavior should be intuitive and having different types of closures doesn&#8217;t really help IMHO. Also, the solution using intersection makes method definitions far to complex! Say we also want to specify the fact that the block passed to the function might thrown an exception; we would get something like this: </p>
<pre>
public &lt;U,V,throws E extends Exception&gt; ParallelArray&lt;V&gt;
	combine(ParallelArray&lt;U&gt; other, {T,U=&gt;V throws E}&#038;RestrictedFunction combiner) throws E{ ... }
</pre>
<p>Which is just ugly. And contrived example or not&#8230; people <em>WILL</em> start doing this!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jbloch</title>
		<link>http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/#comment-12508</link>
		<dc:creator>jbloch</dc:creator>
		<pubDate>Fri, 21 Dec 2007 21:50:09 +0000</pubDate>
		<guid isPermaLink="false">http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/#comment-12508</guid>
		<description>Sorry, I see no mention of this rule (concerning the =&#62; syntax and restricted closures) in the proposal (&lt;a href="http://www.javac.info/closures-v05.html" rel="nofollow"&gt;http://www.javac.info/closures-v05.html&lt;/a&gt;), and I have no recollection of the conversation that Neal refers to. When I prepared the "Closures Controversy" talk, I based it on the best and most current information at my disposal.  And I continue to believe that adding non-local returns to Java would add enormous and unnecessary complexity.  (Of course non-local returns make good sense in languages like Ruby, which were designed around closure-based control structures.)

Josh</description>
		<content:encoded><![CDATA[<p>Sorry, I see no mention of this rule (concerning the =&gt; syntax and restricted closures) in the proposal (<a href="http://www.javac.info/closures-v05.html" rel="nofollow">http://www.javac.info/closures-v05.html</a>), and I have no recollection of the conversation that Neal refers to. When I prepared the &#8220;Closures Controversy&#8221; talk, I based it on the best and most current information at my disposal.  And I continue to believe that adding non-local returns to Java would add enormous and unnecessary complexity.  (Of course non-local returns make good sense in languages like Ruby, which were designed around closure-based control structures.)</p>
<p>Josh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nmgafter</title>
		<link>http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/#comment-12505</link>
		<dc:creator>nmgafter</dc:creator>
		<pubDate>Fri, 21 Dec 2007 20:46:43 +0000</pubDate>
		<guid isPermaLink="false">http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/#comment-12505</guid>
		<description>That link should be &lt;a href="http://gafter.blogspot.com/2007/12/restricted-closures.html" rel="nofollow"&gt;http://gafter.blogspot.com/2007/12/restricted-closures.html&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>That link should be <a href="http://gafter.blogspot.com/2007/12/restricted-closures.html" rel="nofollow">http://gafter.blogspot.com/2007/12/restricted-closures.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nmgafter</title>
		<link>http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/#comment-12504</link>
		<dc:creator>nmgafter</dc:creator>
		<pubDate>Fri, 21 Dec 2007 20:46:02 +0000</pubDate>
		<guid isPermaLink="false">http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/#comment-12504</guid>
		<description>Of course the error message will be improved once the implementation supports return in the control invocation syntax.  A closure written using the =&#62; syntax, or converted to a function type written using the =&#62; syntax, will be "restricted" and not allowed to return from the enclosing method.  See , specifically the last two paragraphs, for a discussion of the way the semantics will work once implemented.  I called this to Josh's attention about two weeks before his presentation, so I don't know why he included it as if it is an unsolved problem.</description>
		<content:encoded><![CDATA[<p>Of course the error message will be improved once the implementation supports return in the control invocation syntax.  A closure written using the =&gt; syntax, or converted to a function type written using the =&gt; syntax, will be &#8220;restricted&#8221; and not allowed to return from the enclosing method.  See , specifically the last two paragraphs, for a discussion of the way the semantics will work once implemented.  I called this to Josh&#8217;s attention about two weeks before his presentation, so I don&#8217;t know why he included it as if it is an unsolved problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/#comment-12502</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Fri, 21 Dec 2007 20:17:15 +0000</pubDate>
		<guid isPermaLink="false">http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/#comment-12502</guid>
		<description>The error message generated by the BGGA compiler does indeed suggest that non-local returns will be allowed in the future; but it something like this will probably be open for debate.</description>
		<content:encoded><![CDATA[<p>The error message generated by the BGGA compiler does indeed suggest that non-local returns will be allowed in the future; but it something like this will probably be open for debate.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/#comment-12501</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Fri, 21 Dec 2007 20:12:26 +0000</pubDate>
		<guid isPermaLink="false">http://maas-frensch.com/peter/2007/12/21/closures-and-the-return-of-the-return/#comment-12501</guid>
		<description>I've added some tags to the post to fix the formatting.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve added some tags to the post to fix the formatting.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
