Alternative syntax for closures

Rémi Forax forax at univ-mlv.fr
Tue Jul 15 15:08:21 PDT 2008


Neal Gafter a écrit :
> And how is your method invoked?  
like that:
bolean cond=...
myIf(cond) {
  //true part
} {
  //false part
}

> How do I get exception transparency for non-trailing arguments?
There is no way.

Rémi
>
> On Tue, Jul 15, 2008 at 1:16 PM, Rémi Forax <forax at univ-mlv.fr 
> <mailto:forax at univ-mlv.fr>> wrote:
>
>     Neal Gafter a écrit :
>
>         Can you please show me how you intend one would write the
>         equivalent of the following BGGA method?
>
>         *<throws E> void myIf(
>              boolean cond,
>              {=>void throws E} truePart,
>              {=>void throws E} falsePart) throws E {
>          (cond ? truePart : falsePart).invoke();
>         }
>         *
>
>         Regards,
>         Neal
>
>     Voila :
>     void myIf(boolean cond) truePart() falsePart() {
>      if (cond)
>       truePart().invoke();
>      else
>       falsePart().invoke();
>     }
>
>     Rémi
>
>




More information about the closures-dev mailing list