A syntax option (function types versus arrays)

Howard Lovatt howard.lovatt at gmail.com
Thu Mar 11 00:05:48 PST 2010


Yes, that is also a good suggestion, I have no real preference between  
the two forms. Note the round brackets around the arguments replace  
commas, so they are not really surpurfolous.

   -- Howard Lovatt +61 419 971 263 (sent from iPhone)

On 11/03/2010, at 6:50 PM, Gernot Neppert <mcnepp02 at googlemail.com>  
wrote:

>>
>> A possible alternate syntax is:
>>
>> #< R( A ) throws E > example = new #< R( A a ) throws E >( ... );
>>
>
> I like the following two things about this syntax:
>
> firstly, the use of "new" to create a lambda. This makes it consistent
> with other object instantiations (in this case, an object of function
> type being created).
>
> secondly, the idea to re-use the syntax for parameterized types.
>
> However, I do not like these two things:
>
> firstly, as a matter of personal taste, the token sequence '#<' looks
> rather ugly, especially if nested.
>
> secondly, borrowing the syntax from generic type declarations seems
> half-hearted: there are still parentheses within the '<>' tokens.
>
> Why not go all the way to:
>
> lambda<void,byte[],int,int, throws IOException> writer = new
> lambda<void,byte[] buf, int off, int len, throws IOException> {
> System.out.write(buf, off, len);
> }
>
> The keyword 'lambda' introduces the generic function type.
> At least one type variable must follow, indicating the return type.
> Further type variables may follow, indicating the argument types.
> Further type variables may follow the keyword 'throws', indicating the
> types of the checked Exceptions being thrown.


More information about the lambda-dev mailing list