[nem-en] Re: Where to apply type arguments
Andrey Khropov
andrey.khropov at gmail.com
Tue Jan 30 15:53:44 CET 2007
Michal Moskal wrote:
> On 1/30/07, Vladimir Reshetnikov <v.reshetnikov at gmail.com> wrote:
> > public class A[T] {
> > public class B[S] { }
> > }
> >
> > _ = A.[int].B.[string](); // Works
> > _ = A.B.[int,string]() // Also works
> >
> > These two syntaxes are equivalent, arn't they?
>
> They are. I'm not sure if this such a great idea though.
I think it's not a good idea and the last variant should be banned. Because
it's not logical - each type parameter belongs to its respective class. for
each A[T] B has one type parameter and A.B should only mean A.[<inferred T>].B.
Otherwise we have problems:
public class A1[T] {
public class B1[S] { }
}
public class A2 {
public class B2[T,S] { }
}
So with the present situation those can look the same thus producing confusion.
A1.B1.[int,int]
A2.B2.[int,int]
Besides that it also makes overloading by the number of type parameters (which
should be supported IMHO) troublesome.
--
AKhropov
More information about the devel-en
mailing list