A syntax option (function types versus arrays)
Mark Mahieu
markmahieu at googlemail.com
Mon Mar 1 16:05:32 PST 2010
On 1 Mar 2010, at 23:42, Neal Gafter wrote:
>
> I agree with Rémi that you don't need so many parens. You could put
> the throws either before or after the result type. I'd also suggest
> keeping the lambda and function type syntax forms parallel in part
> because the lambda is the primary, and currently only, way to get a
> value of function type. For example either
>
> (String -> int throws SomeException) variable = (String x -> 3);
>
> or, as Rémi suggests
>
> (String throws SomeException -> int) variable = (String x -> 3);
>
> So the curry example would be something like
>
> static <T,U,V,X extends Throwable>
> (T->(U throws X->V)) curry((T,U throws X->V) function) {
> return (T t->(U u->function.(t,u)));
> }
>
> Cheers,
> Neal
>
That's pretty good in my eyes - for these non-trivial types I think it's much easier to follow than the equivalent code using the currently proposed syntax.
It's easy to see where each function type or lambda begins and ends (and editors/IDEs will be able to offer matching bracket highlighting as they do elsewhere in the language).
Mark
More information about the lambda-dev
mailing list