<?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 on: I want closures &#8220;bolted on to Java&#8221;</title>
	<atom:link href="http://maas-frensch.com/peter/2008/10/11/i-want-closures-bolted-on-to-java/feed/" rel="self" type="application/rss+xml" />
	<link>http://maas-frensch.com/peter/2008/10/11/i-want-closures-bolted-on-to-java/</link>
	<description>Peter Maas's Weblog</description>
	<pubDate>Tue, 06 Jan 2009 09:49:04 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Howard Lovatt</title>
		<link>http://maas-frensch.com/peter/2008/10/11/i-want-closures-bolted-on-to-java/comment-page-1/#comment-94010</link>
		<dc:creator>Howard Lovatt</dc:creator>
		<pubDate>Mon, 13 Oct 2008 23:03:36 +0000</pubDate>
		<guid isPermaLink="false">http://maas-frensch.com/peter/?p=428#comment-94010</guid>
		<description>@Peter,

If people want read/write access to a variable then add it to inner classes along with short syntax for instances of an anonymous inner class. What I object to is something that isn't an object and has different semantics that are going to be at best different than the rest and at worst just plain confusing.

What are the advantages of the different semantics, particularly the restriction that a BGGA closure doesn't inherit?</description>
		<content:encoded><![CDATA[<p>@Peter,</p>
<p>If people want read/write access to a variable then add it to inner classes along with short syntax for instances of an anonymous inner class. What I object to is something that isn&#8217;t an object and has different semantics that are going to be at best different than the rest and at worst just plain confusing.</p>
<p>What are the advantages of the different semantics, particularly the restriction that a BGGA closure doesn&#8217;t inherit?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://maas-frensch.com/peter/2008/10/11/i-want-closures-bolted-on-to-java/comment-page-1/#comment-94009</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Mon, 13 Oct 2008 05:27:28 +0000</pubDate>
		<guid isPermaLink="false">http://maas-frensch.com/peter/?p=428#comment-94009</guid>
		<description>@Howard Lovatt

Nobody said we would be  _removing_ Inner classes. The limitation I see with Inner Class classes is actually the scoping of context variables. I know the CICE proposal wants to address just this by doing minor adjustments. I would however prefer a more concise syntax.</description>
		<content:encoded><![CDATA[<p>@Howard Lovatt</p>
<p>Nobody said we would be  _removing_ Inner classes. The limitation I see with Inner Class classes is actually the scoping of context variables. I know the CICE proposal wants to address just this by doing minor adjustments. I would however prefer a more concise syntax.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://maas-frensch.com/peter/2008/10/11/i-want-closures-bolted-on-to-java/comment-page-1/#comment-94008</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Mon, 13 Oct 2008 05:22:26 +0000</pubDate>
		<guid isPermaLink="false">http://maas-frensch.com/peter/?p=428#comment-94008</guid>
		<description>@Marcos Silva Pereira

Yes extension methods (or mixins) are something I'd like to have as well. It would reduce the need to change existing API's.</description>
		<content:encoded><![CDATA[<p>@Marcos Silva Pereira</p>
<p>Yes extension methods (or mixins) are something I&#8217;d like to have as well. It would reduce the need to change existing API&#8217;s.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Howard Lovatt</title>
		<link>http://maas-frensch.com/peter/2008/10/11/i-want-closures-bolted-on-to-java/comment-page-1/#comment-94007</link>
		<dc:creator>Howard Lovatt</dc:creator>
		<pubDate>Mon, 13 Oct 2008 04:32:56 +0000</pubDate>
		<guid isPermaLink="false">http://maas-frensch.com/peter/?p=428#comment-94007</guid>
		<description>I can see a case for shorter syntax; but I don't see why we have to have all the baggage of the BGGA closure, it creates another 'thing' that gets boxed by a closure conversion in a similar manner to how primitives are boxed. (Actually two new 'things', either a restricted or non-restricted closure.) The examples given would be just as good with inner classes that had a short syntax. Inner classes are also more powerful; since they have two this pointers, one to the enclosing scope and one to their inherited scope.

What is the advantage of new semantics that are less powerful than those we already have?</description>
		<content:encoded><![CDATA[<p>I can see a case for shorter syntax; but I don&#8217;t see why we have to have all the baggage of the BGGA closure, it creates another &#8216;thing&#8217; that gets boxed by a closure conversion in a similar manner to how primitives are boxed. (Actually two new &#8216;things&#8217;, either a restricted or non-restricted closure.) The examples given would be just as good with inner classes that had a short syntax. Inner classes are also more powerful; since they have two this pointers, one to the enclosing scope and one to their inherited scope.</p>
<p>What is the advantage of new semantics that are less powerful than those we already have?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcos Silva Pereira</title>
		<link>http://maas-frensch.com/peter/2008/10/11/i-want-closures-bolted-on-to-java/comment-page-1/#comment-94006</link>
		<dc:creator>Marcos Silva Pereira</dc:creator>
		<pubDate>Mon, 13 Oct 2008 03:45:39 +0000</pubDate>
		<guid isPermaLink="false">http://maas-frensch.com/peter/?p=428#comment-94006</guid>
		<description>Peter, 

In order to get more powerful use from the new resources, some changes must be made in API. An example is your select method that could be part of the API. There is a lot of places where methods could be added to get advantage from new language features. Maybe, a required complement to Closures is Extension Methods (http://msdn.microsoft.com/en-us/library/bb383977.aspx). So, we will write code like this:

import extension java.util.CollectionsExtension; // I'm just illustrating my point here.

List wordsContainingK = words.select({String it =&#62; it.contains("k")});

Wow, almost Groovy, huh?</description>
		<content:encoded><![CDATA[<p>Peter, </p>
<p>In order to get more powerful use from the new resources, some changes must be made in API. An example is your select method that could be part of the API. There is a lot of places where methods could be added to get advantage from new language features. Maybe, a required complement to Closures is Extension Methods (http://msdn.microsoft.com/en-us/library/bb383977.aspx). So, we will write code like this:</p>
<p>import extension java.util.CollectionsExtension; // I&#8217;m just illustrating my point here.</p>
<p>List wordsContainingK = words.select({String it =&gt; it.contains(&#8221;k&#8221;)});</p>
<p>Wow, almost Groovy, huh?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://maas-frensch.com/peter/2008/10/11/i-want-closures-bolted-on-to-java/comment-page-1/#comment-94004</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Sun, 12 Oct 2008 17:01:12 +0000</pubDate>
		<guid isPermaLink="false">http://maas-frensch.com/peter/?p=428#comment-94004</guid>
		<description>I think that the closures proposals illustrate that you don't _have_ to change the API:

[java]
Collections.sort(words, {String a, String b =&gt; b.compareTo(a)}); 
new Thread({=&gt; System.out.prinltn("running")}).start(); 
[/java]

this works for all API methods eating single method interfaces. This is a good start; API's will follow later.</description>
		<content:encoded><![CDATA[<p>I think that the closures proposals illustrate that you don't _have_ to change the API:</p>
<div class="igBar"><span id="ljava-1"><a href="#" onclick="javascript:showPlainTxt('java-1'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVA:</span>
<div id="java-1">
<div class="java">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Collections.<span style="color: #111111;">sort</span><span style="color: #333333;">&#40;</span>words, <span style="color: #333333;">&#123;</span>String a, String b =&gt; b.<span style="color: #111111;">compareTo</span><span style="color: #333333;">&#40;</span>a<span style="color: #333333;">&#41;</span><span style="color: #333333;">&#125;</span><span style="color: #333333;">&#41;</span>; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #7f0055; font-weight: bold;">new</span> Thread<span style="color: #333333;">&#40;</span><span style="color: #333333;">&#123;</span>=&gt; System.<span style="color: #111111;">out</span>.<span style="color: #111111;">prinltn</span><span style="color: #333333;">&#40;</span><span style="color: #2a00ff;">"running"</span><span style="color: #333333;">&#41;</span><span style="color: #333333;">&#125;</span><span style="color: #333333;">&#41;</span>.<span style="color: #111111;">start</span><span style="color: #333333;">&#40;</span><span style="color: #333333;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>this works for all API methods eating single method interfaces. This is a good start; API's will follow later.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivan</title>
		<link>http://maas-frensch.com/peter/2008/10/11/i-want-closures-bolted-on-to-java/comment-page-1/#comment-94003</link>
		<dc:creator>Ivan</dc:creator>
		<pubDate>Sun, 12 Oct 2008 16:48:54 +0000</pubDate>
		<guid isPermaLink="false">http://maas-frensch.com/peter/?p=428#comment-94003</guid>
		<description>Java desperately needs new language features. It needs a realistic ability to compete with C#.
The problem is: what is the point of a language feature, if the API stays the same?

An example of such inconsistency is PHP: One can do OOP in PHP, but when the API itself isn't OOP, it's uncomfortable. (PHP sucks anyway, most inconsistent 'programming' language).

The API should act as an "example of good development concepts".
Typical scenario: "Hmmm, what's that language feature for? Hey, I just search the API and see how it's used there."

Break compatibility! Make Java 8 ;) New features plus an API that uses them.</description>
		<content:encoded><![CDATA[<p>Java desperately needs new language features. It needs a realistic ability to compete with C#.<br />
The problem is: what is the point of a language feature, if the API stays the same?</p>
<p>An example of such inconsistency is PHP: One can do OOP in PHP, but when the API itself isn't OOP, it's uncomfortable. (PHP sucks anyway, most inconsistent 'programming' language).</p>
<p>The API should act as an "example of good development concepts".<br />
Typical scenario: "Hmmm, what's that language feature for? Hey, I just search the API and see how it's used there."</p>
<p>Break compatibility! Make Java 8 <img src='http://maas-frensch.com/peter/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> New features plus an API that uses them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sakuraba</title>
		<link>http://maas-frensch.com/peter/2008/10/11/i-want-closures-bolted-on-to-java/comment-page-1/#comment-94002</link>
		<dc:creator>Sakuraba</dc:creator>
		<pubDate>Sun, 12 Oct 2008 15:46:22 +0000</pubDate>
		<guid isPermaLink="false">http://maas-frensch.com/peter/?p=428#comment-94002</guid>
		<description>Experimentation yes, but also segmentation. If such a fundamental change to the way API's are written (see ForkJoin Framework with and without Closures...) is done to Java, then it needs to be discussed in its depth, made consistent as well as easy and reside directly inside the JDK.


People are always afraid of change, but change is necessary to remain let alone to grow. I miss not having C# style properties in Java, i dont like the boilerplate code of anonymous inner classes for simply passing some lexically scoped code around. I dont like the lack of type inference and the resulting type duplication when using generics extensively. These things should be fixed.


Nothing is too late for JDK7. Some people are still on JDK 1.4 and start new projects with JDK 5 only. It is going to take some time till JDK6 is widly adopted. There is enough time to make a big and healthy step with JDK7.</description>
		<content:encoded><![CDATA[<p>Experimentation yes, but also segmentation. If such a fundamental change to the way API's are written (see ForkJoin Framework with and without Closures...) is done to Java, then it needs to be discussed in its depth, made consistent as well as easy and reside directly inside the JDK.</p>
<p>People are always afraid of change, but change is necessary to remain let alone to grow. I miss not having C# style properties in Java, i dont like the boilerplate code of anonymous inner classes for simply passing some lexically scoped code around. I dont like the lack of type inference and the resulting type duplication when using generics extensively. These things should be fixed.</p>
<p>Nothing is too late for JDK7. Some people are still on JDK 1.4 and start new projects with JDK 5 only. It is going to take some time till JDK6 is widly adopted. There is enough time to make a big and healthy step with JDK7.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: falcon</title>
		<link>http://maas-frensch.com/peter/2008/10/11/i-want-closures-bolted-on-to-java/comment-page-1/#comment-94000</link>
		<dc:creator>falcon</dc:creator>
		<pubDate>Sun, 12 Oct 2008 07:28:44 +0000</pubDate>
		<guid isPermaLink="false">http://maas-frensch.com/peter/?p=428#comment-94000</guid>
		<description>I've been thinking along the same lines.  Have a very simple, minimalist extension which adds closures of some sort.  Make it available as a command line tool, provide an ant task, get eclipse and netbeans to recognize it.

Better yet (and certainly more controversial), create a way to deal with custom pre-processors (or macros).  Let people distribute syntax extensions/translations the way jars are shared.  Perhaps one out of 500 will be worth using...but it will open java up to a lot more experimentation.</description>
		<content:encoded><![CDATA[<p>I've been thinking along the same lines.  Have a very simple, minimalist extension which adds closures of some sort.  Make it available as a command line tool, provide an ant task, get eclipse and netbeans to recognize it.</p>
<p>Better yet (and certainly more controversial), create a way to deal with custom pre-processors (or macros).  Let people distribute syntax extensions/translations the way jars are shared.  Perhaps one out of 500 will be worth using...but it will open java up to a lot more experimentation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://maas-frensch.com/peter/2008/10/11/i-want-closures-bolted-on-to-java/comment-page-1/#comment-93998</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Sat, 11 Oct 2008 15:47:33 +0000</pubDate>
		<guid isPermaLink="false">http://maas-frensch.com/peter/?p=428#comment-93998</guid>
		<description>Thanks Patrick, for pointing out that discussion! I do also think that the syntax could be a bit more clear than the BGGA solution; the BGGA synthax would however be good enough for... anything as powerful but more concise would be a bons.</description>
		<content:encoded><![CDATA[<p>Thanks Patrick, for pointing out that discussion! I do also think that the syntax could be a bit more clear than the BGGA solution; the BGGA synthax would however be good enough for... anything as powerful but more concise would be a bons.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
