function types syntax

Rémi Forax forax at univ-mlv.fr
Tue Jan 5 08:04:42 PST 2010


Le 05/01/2010 15:43, Peter Levart a écrit :
> On Tuesday 05 January 2010 15:14:19 Rémi Forax wrote:
>    
>>> I'm wondering if the leading '#' is necessary. Would it be ambiguous to leave it out?
>>>        
>> I think there is a problem with the cast and parenthesis between
>> expression :
>>     (A())
>> can be read as a cast to a function that returns a A or as a call to
>> function A
>> between parenthesis.
>>
>>      
> But the cast can not appear by itself where expression (parenthesized function call) is expected?
>    

 From the JLS3 grammar, an Expression can be a PrimaryNoNewArray that 
can be derived to a parenthesis expression and it can also be a 
CastExpression.
So cast can appear where parenthesized function call can appear.

Example:
2 + (A()) ...

> Peter
>    

Rémi



More information about the lambda-dev mailing list