Function types versus arrays
Peter Levart
peter.levart at marand.si
Fri Feb 12 00:45:09 PST 2010
On Friday 12 February 2010 08:39:26 Peter Levart wrote:
> In analogy with parameterized types I propose a notation for "raw" function types. For example:
>
> // produces unchecked assignment warning
> #String(String,String)[] a1 = new #?(?,?)[] { #(String s1, String s2)(s1+"_"+s2) };
>
> Primitive returns/parameters can be mixed into "raw" function type to produce a "mixed raw/primitive" function type:
>
> // produces unchecked assignment warning
> #int(String)[] a2 = new #int(?)[] { #(String s)(s.length()) };
>
> What to do with throws types? Treat them the same as a return type?
>
> // produces unchecked assignment warning
> #String(File)(throws IOException)[] a3 = new #?(?)(throws ?)[] { };
>
Or better (since '?' already has a different meaning in parameterized types) the following:
#String(String,String)[] a1 = new #*(*,*)[] { #(String s1, String s2)(s1+"_"+s2) };
#int(String)[] a2 = new #int(*)[] { #(String s)(s.length()) };
#String(File)(throws IOException)[] a3 = new #*(*)(throws *)[] { };
Regards, Peter
More information about the lambda-dev
mailing list