yet another function types syntax variation
Peter Levart
peter.levart at marand.si
Tue Feb 9 08:07:04 PST 2010
On Tuesday 09 February 2010 14:05:58 Zdenek Tronicek wrote:
> Peter Levart napsal(a):
> > What would happen if the '#' and 'ReturnType' changed places?
> >
> > FunctionType:
> > ReturnType '#' '(' ParameterTypes_opt ')' Throws_opt
> >
> >
> > Nested return types might look better:
> >
> > ##int(byte[],int,int)(throws IOException)(File)(throws IOException)
> >
> > vs.
> >
> > int #(byte[],int,int) throws IOException #(File) throws IOException
>
> My subjective opinion is: it does not look better. Why? I am reading the
> line from left to right. If I see ## I know that the return type is
> function. In your proposal, I have to read all "int #(byte[],int,int)
> throws IOException" until I get to know that it is return type.
>
If you see ## you know that return type is function, but you still don't know the return type. You have to find a matching ')' to know what constitutes it, isn't that right? This is worsened by the maybe-yes-maybe-not presence of second pair of parens enclosing optional throws declaration.
I think that finding '#' is easier since it sticks out from the crowd.
Regards, Peter
More information about the lambda-dev
mailing list