atom feed13 messages in net.java.openjdk.closures-devRe: related link
FromSent OnAttachments
Neal GafterFeb 7, 2010 9:10 am 
John NilssonFeb 7, 2010 2:50 pm 
Neal GafterFeb 7, 2010 3:36 pm 
John NilssonFeb 8, 2010 9:20 am 
Neal GafterFeb 8, 2010 11:03 am 
John NilssonFeb 8, 2010 2:44 pm 
Neal GafterFeb 8, 2010 3:34 pm 
John RoseFeb 9, 2010 11:21 am 
John NilssonFeb 9, 2010 12:21 pm 
John NilssonFeb 9, 2010 12:50 pm 
Neal GafterFeb 9, 2010 1:05 pm 
John NilssonFeb 9, 2010 1:51 pm 
Neal GafterFeb 9, 2010 1:54 pm 
Subject:Re: related link
From:John Rose (John@Sun.COM)
Date:Feb 9, 2010 11:21:53 am
List:net.java.openjdk.closures-dev

On Feb 8, 2010, at 11:03 AM, Neal Gafter wrote:

FYI, experience with languages that support "non-local return" (Scala, Ruby, etc) has resulted in a remarkable absence of scary things happening. They're really quite boring and ordinary once you try them.

...and Lisp, Smalltalk. The experience with such constructs spans almost the
entire history of software. People who've actually used such constructs are not
afraid of them.

The experience of Ruby particularly shows the chaos you get into when you come
to the "return" fork and take both sides: Now they have multiple constructs
that handle "return" differently, and they are having to back and fill (in 1.9)
to rationalize the mess. The Python designers were wiser and restricted closure
bodies to simple expressions, to dodge the "return" question completely.

Regarding "scariness": Given any language extension proposal, a significant
number of people (not just a few) will be vocally afraid of the unknown effects
of the proposal. Of those who were excited enough to comment on Inner Classes in
1.1, about 30% accused us of ruining Java. Some still think so, probably, but
on the whole it doesn't matter. For most people, the unknown eventually became
the known, and it was (to everyone's relief) a livable reality.

Regarding the specific dangers of uplevel branch: An unmatched uplevel branch,
which causes an exception when executed, is annoyingly dynamic. It is
self-diagnosing, exactly like a NPE or CCE. And BGGA has a novel static check
for restricting branches to appropriate APIs, so there's a static story too,
unlike NPE or CCE. And (as those who have used such things know by experience)
the problem comes up much less often than NPE or CCE does in Java.

Compared with the largely-hypothetical dangers of uplevel branches, I am
personally much more afraid, based on experience with Lisp, of unexpected,
undiagnosed effects of the "dotimes bug"[1] with captured mutable locals.

-- John

[1]
http://blogs.msdn.com/ericlippert/archive/2009/11/12/closing-over-the-loop-variable-considered-harmful.aspx See also my comment on that web page.