function types syntax

Peter Levart peter.levart at marand.si
Tue Jan 5 05:36:00 PST 2010


Strawman proposal specifies the following syntax for function types (without throws declaration for now, but it suggests that it could be added later):

# Type ( TypeList opt ) ThrowsDecl opt

For example:

#void() - a function taking no arguments returning nothing
#BigDecimal(String) throws ParseException - a function taking a single String returning BigDecimal throwing ParseException
##int(int)(#int(int)) - function taking a single (function taking a single int returning int) returning a function taking a single int returning int

I'm wondering if the leading '#' is necessary. Would it be ambiguous to leave it out? The above examples would then read:

void()
BigDecimal(String) throws ParseException
int(int)(int(int))

I think someone mentioned that similarity between the syntax-es of function types and lambda expressions is actually not a good thing.

What do you think?

Regards, Peter


More information about the lambda-dev mailing list