Non-local transfers: deja-vu

Neal Gafter neal at gafter.com
Mon Jan 4 10:31:03 PST 2010


On Mon, Jan 4, 2010 at 7:34 AM, Gernot Neppert <mcnepp02 at googlemail.com> wrote:
> first of all, I need to say I'm thrilled that a simplified syntax for
> anonymous function types is going to be part of Java finally!
>
> What amazes me, however, is the fact that Neal Gafter's proposal about
> a "Control Invocation syntax" is being seriously considered again.

You posted this question to a mailing list that is specifically and
explicitly about developing a closures implementation that supports a
control invocation syntax.  It never stopped being about that.

> Of course I don't dispute his right to bring it up again, but I wonder
> why nobody seems to remember that BGGA died largely due to the heated
> debate about the insurmountable intricacies that ensued this proposal.

I recall the most heated debate being about function types, and that
question seems to have been settled by fiat of Mark Reinhold.

Don't confuse the fact that you don't know how to produce a
specification that you find acceptable with the purported fact that
it's not possible.  The latest specification (CfJ 0.6 a/b) shows that
the additional specification complexity (part b) is not intricate
compared to a specification without that support (part a), nor are the
issues insurmountable.

> The following example was discussed today in this mailing list:
>
> #int() one = null;
> synchronized int sum(int n) {
>
>  if (one == null) one = #() { return 1; };
>
>  return n == 0 ? 0 : sum(n-1) + one();
> }
>
> To me, the idea that the expression "return 1" within the lambda
> should mean anything else but return the value 1 from the lambda is
> absurd!

That was the point of the example.  Glad to see you got it.

That "puzzle" is with respect to a hypothetical specification that
makes statement lambdas transparent.  That's not what I recommend, nor
what project lambda proposes, nor what CfJ 0.6 a/b specifies.  Your
concern about this class of example is shared by others, which is why
the problem was brought up: we want to ensure that the form of
specification we end up with is intuitive in this way.  We will
continue to use examples like this to ensure that the result is
intuitive.

> So I'm asking: Do we really *want* either of Control Invocation Syntax
> or Non-Local Transfers  (the former requiring the latter but not vice
> versa)?

For me the answer is "yes" and "yes".  However, you'll find that there
is not unanimous agreement about any aspect of any language feature.

Cheers,
Neal


More information about the closures-dev mailing list