<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Closure Syntax Wars</title>
	<atom:link href="http://warpedjavaguy.wordpress.com/2008/02/28/closure-syntax-wars/feed/" rel="self" type="application/rss+xml" />
	<link>http://warpedjavaguy.wordpress.com/2008/02/28/closure-syntax-wars/</link>
	<description>Observations of everyday Java phenomena</description>
	<lastBuildDate>Tue, 13 Jan 2009 18:04:18 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Mario</title>
		<link>http://warpedjavaguy.wordpress.com/2008/02/28/closure-syntax-wars/#comment-344</link>
		<dc:creator>Mario</dc:creator>
		<pubDate>Tue, 30 Sep 2008 18:38:56 +0000</pubDate>
		<guid isPermaLink="false">http://warpedjavaguy.wordpress.com/?p=31#comment-344</guid>
		<description>I really like the Java Method Pointer syntax. It&#039;s perfect in my mind and way better than &quot;fat arrow&quot; notation.</description>
		<content:encoded><![CDATA[<p>I really like the Java Method Pointer syntax. It&#8217;s perfect in my mind and way better than &#8220;fat arrow&#8221; notation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ride</title>
		<link>http://warpedjavaguy.wordpress.com/2008/02/28/closure-syntax-wars/#comment-316</link>
		<dc:creator>Ride</dc:creator>
		<pubDate>Wed, 18 Jun 2008 16:37:53 +0000</pubDate>
		<guid isPermaLink="false">http://warpedjavaguy.wordpress.com/?p=31#comment-316</guid>
		<description>Somehow i missed the point. Probably lost in translation :) Anyway ... nice blog to visit.

cheers, Ride
.</description>
		<content:encoded><![CDATA[<p>Somehow i missed the point. Probably lost in translation <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Anyway &#8230; nice blog to visit.</p>
<p>cheers, Ride<br />
.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WarpedJavaGuy</title>
		<link>http://warpedjavaguy.wordpress.com/2008/02/28/closure-syntax-wars/#comment-290</link>
		<dc:creator>WarpedJavaGuy</dc:creator>
		<pubDate>Mon, 17 Mar 2008 13:31:16 +0000</pubDate>
		<guid isPermaLink="false">http://warpedjavaguy.wordpress.com/?p=31#comment-290</guid>
		<description>Rex,

Sensible defaults and compiler interpretations are one thing but powerful abstractions and actual closures are another.  

Full closures would provide Java with a more complete and extensible solution.  They would solve all the common problems already mentioned and allow developers to solve even more.  A lot more!  A compiler/parser solution would be too limiting for developers and would not add any value to the API.  Full closures would add a lot of value.

The closure syntax is what really concerns me though.</description>
		<content:encoded><![CDATA[<p>Rex,</p>
<p>Sensible defaults and compiler interpretations are one thing but powerful abstractions and actual closures are another.  </p>
<p>Full closures would provide Java with a more complete and extensible solution.  They would solve all the common problems already mentioned and allow developers to solve even more.  A lot more!  A compiler/parser solution would be too limiting for developers and would not add any value to the API.  Full closures would add a lot of value.</p>
<p>The closure syntax is what really concerns me though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rex</title>
		<link>http://warpedjavaguy.wordpress.com/2008/02/28/closure-syntax-wars/#comment-286</link>
		<dc:creator>Rex</dc:creator>
		<pubDate>Thu, 13 Mar 2008 20:10:51 +0000</pubDate>
		<guid isPermaLink="false">http://warpedjavaguy.wordpress.com/?p=31#comment-286</guid>
		<description>I&#039;m not sure that closures are needed as BGGA or FCM.  They&#039;re complicated solutions to simple problems.

Anonymous class instance creation can be done just fine by making the compiler smart about interpreting what you write.

Taking the classic comparison example, observe the following chain:
  Collections.sort( list , new Comparator() { public int compare(Integer a,Integer b) { return a-b; } } );
// There&#039;s only one method, use an easier way to pick it out:
  Collections.sort( list , new int Comparator.compare(Integer a,Integer b) { return a-b; } );
// The interface requires type matching of arguments, so
  Collections.sort( list , new int Comparator.compare(a,b) { return a-b; } );
// Sort requires a type-matched comparator
  Collections.sort( list , new int compare(a,b) { return a-b; } );
// compare is the only method not in Object
  Collections.sort( list , new int ?(a,b) { return a-b; } );
// We obviously want a new thing that returns a value
  Collections.sort( list , int ?(a,b) { a-b } );

You don&#039;t need first-class methods or anything.  The last is more compact than anything suggested by closures, is completely unambiguous, and is a simple matter of making the parser understand sensible defaults.  If there is no sensible default, it&#039;s a compile-time error.

If anything, closures would get in the way of allowing sensible-defaulting to reduce all the redundantly unnecessary code one has to write at the moment.

ARM can be done just like foreach iterators are done now:

interface Resource
{
  void acquireResource();
  void releaseResource();
}

(You could do this fine without generics also.)

Now, anything that has resources implements the interface, and we interpret:

try ( my_object ) { . . . }

as

my_object.acquireResource();
try { . . . }
finally { my_object.releaseResource(); }

No perplexing return-does-different-things needed like in BGGA; it just works, and in the manner of foreach.

Speaking of foreach, closures let you cover every case (with questionable clarity), but what are the common cases?

Dual iteration has a natural extension:
  for (String s : stringlist ; double d : numberlist)
  { System.out.println(s + &quot; has value &quot; + d); }

Subdivision of complex iterators have a natural extension:
  for (String s,double d : hashmap)
  { System.out.println(&quot;Key &quot; + s + &quot; has value &quot; + d); }
where this is specifically smart enough to understand key,value pairs.

Anyway, making the language require a lot less unnecessarily repetitive typing doesn&#039;t require closures at all.  There are other solutions that fit better with the language structure and which solve the problems better.

Closures/lambda functions can be useful if you don&#039;t have inner classes, or if you don&#039;t have robust types.  I can&#039;t see how Java benefits from them in any interesting way.</description>
		<content:encoded><![CDATA[<p>I&#8217;m not sure that closures are needed as BGGA or FCM.  They&#8217;re complicated solutions to simple problems.</p>
<p>Anonymous class instance creation can be done just fine by making the compiler smart about interpreting what you write.</p>
<p>Taking the classic comparison example, observe the following chain:<br />
  Collections.sort( list , new Comparator() { public int compare(Integer a,Integer b) { return a-b; } } );<br />
// There&#8217;s only one method, use an easier way to pick it out:<br />
  Collections.sort( list , new int Comparator.compare(Integer a,Integer b) { return a-b; } );<br />
// The interface requires type matching of arguments, so<br />
  Collections.sort( list , new int Comparator.compare(a,b) { return a-b; } );<br />
// Sort requires a type-matched comparator<br />
  Collections.sort( list , new int compare(a,b) { return a-b; } );<br />
// compare is the only method not in Object<br />
  Collections.sort( list , new int ?(a,b) { return a-b; } );<br />
// We obviously want a new thing that returns a value<br />
  Collections.sort( list , int ?(a,b) { a-b } );</p>
<p>You don&#8217;t need first-class methods or anything.  The last is more compact than anything suggested by closures, is completely unambiguous, and is a simple matter of making the parser understand sensible defaults.  If there is no sensible default, it&#8217;s a compile-time error.</p>
<p>If anything, closures would get in the way of allowing sensible-defaulting to reduce all the redundantly unnecessary code one has to write at the moment.</p>
<p>ARM can be done just like foreach iterators are done now:</p>
<p>interface Resource<br />
{<br />
  void acquireResource();<br />
  void releaseResource();<br />
}</p>
<p>(You could do this fine without generics also.)</p>
<p>Now, anything that has resources implements the interface, and we interpret:</p>
<p>try ( my_object ) { . . . }</p>
<p>as</p>
<p>my_object.acquireResource();<br />
try { . . . }<br />
finally { my_object.releaseResource(); }</p>
<p>No perplexing return-does-different-things needed like in BGGA; it just works, and in the manner of foreach.</p>
<p>Speaking of foreach, closures let you cover every case (with questionable clarity), but what are the common cases?</p>
<p>Dual iteration has a natural extension:<br />
  for (String s : stringlist ; double d : numberlist)<br />
  { System.out.println(s + &#8221; has value &#8221; + d); }</p>
<p>Subdivision of complex iterators have a natural extension:<br />
  for (String s,double d : hashmap)<br />
  { System.out.println(&#8220;Key &#8221; + s + &#8221; has value &#8221; + d); }<br />
where this is specifically smart enough to understand key,value pairs.</p>
<p>Anyway, making the language require a lot less unnecessarily repetitive typing doesn&#8217;t require closures at all.  There are other solutions that fit better with the language structure and which solve the problems better.</p>
<p>Closures/lambda functions can be useful if you don&#8217;t have inner classes, or if you don&#8217;t have robust types.  I can&#8217;t see how Java benefits from them in any interesting way.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WarpedJavaGuy</title>
		<link>http://warpedjavaguy.wordpress.com/2008/02/28/closure-syntax-wars/#comment-278</link>
		<dc:creator>WarpedJavaGuy</dc:creator>
		<pubDate>Tue, 04 Mar 2008 11:50:45 +0000</pubDate>
		<guid isPermaLink="false">http://warpedjavaguy.wordpress.com/?p=31#comment-278</guid>
		<description>Yes, we would definitely have a need to write complex constructs ourselves, but not the ones already in the API.</description>
		<content:encoded><![CDATA[<p>Yes, we would definitely have a need to write complex constructs ourselves, but not the ones already in the API.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Talden</title>
		<link>http://warpedjavaguy.wordpress.com/2008/02/28/closure-syntax-wars/#comment-274</link>
		<dc:creator>Talden</dc:creator>
		<pubDate>Tue, 04 Mar 2008 02:02:58 +0000</pubDate>
		<guid isPermaLink="false">http://warpedjavaguy.wordpress.com/?p=31#comment-274</guid>
		<description>The significance is that developers _could_ write those complex constructs themselves rather than only in the API.

Some treat this as bad because badly trained monkeys might produce unintelligible code.

I say that&#039;s what policy, code review, training and hiring good people is about - people are abusing the features of the language already but I&#039;m glad we have the features we do when we need them... I&#039;d have a couple of good uses for closures day #1 and they&#039;ll all simplify code.</description>
		<content:encoded><![CDATA[<p>The significance is that developers _could_ write those complex constructs themselves rather than only in the API.</p>
<p>Some treat this as bad because badly trained monkeys might produce unintelligible code.</p>
<p>I say that&#8217;s what policy, code review, training and hiring good people is about &#8211; people are abusing the features of the language already but I&#8217;m glad we have the features we do when we need them&#8230; I&#8217;d have a couple of good uses for closures day #1 and they&#8217;ll all simplify code.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
