Return Isn't Transparent

Neal Gafter neal at gafter.com
Tue Jul 20 08:03:37 PDT 2010


It looks like you've found a bug.  An invocation expression whose result
type is "Nothing" is defined in the BGGA spec as not completing normally.

On Tue, Jul 20, 2010 at 4:02 AM, Howard Lovatt <howard.lovatt at gmail.com>wrote:

> @ Neal,
>
> I took up your suggestion of downloading BGGA and tried:
>
> 24:  int m() {
> 25:             final { ==> Nothing } return42 = { ==> return 42; };
> 26:             return42.invoke();
> 27: }
>
> and got the error message:
>
> Return42.java:27: missing return statement
>        }
>               ^
>
> So it would seem to me that BGGA only has return transparency for
> "simple cases". This was the point I was trying to clarify, is return
> transparency a general mechanism or does it have limitations?
>
>  -- Howard.
>
> On 20 July 2010 00:58, Neal Gafter <neal at gafter.com> wrote:
> > On Mon, Jul 19, 2010 at 12:07 AM, Howard Lovatt <howard.lovatt at gmail.com
> >
> > wrote:
> >>
> >> > Control-flow and reachability analysis is completely transparent in
> >> > BGGA.
> >>
> >> That doesn't really answer the question directly.
> >
> > Then perhaps I don't understand the question.
> >
> >>
> >> What about a minor variation in BGGA'ish syntax:
> >>
> >>  int m() {
> >>   final { -> Nothing } return42 =  { -> return 42; }.();
> >>   return42.();
> >>   // Oops error - must return value from m
> >>  }
> >
> > One could certainly imagine modifying BGGA so it gets it wrong as your
> > comment suggests, but that's not an error in BGGA.  The end of m's body
> > isn't reachable (because the last statement in m() doesn't complete
> > normally).  This method returns 42.
> >
> > You can download BGGA and try these yourself.
>


More information about the lambda-dev mailing list