Thanks. That's very helpful.

On Sun, Mar 21, 2010 at 10:13 PM, Sandro Magi <[email protected]> wrote:
> On 21/03/2010 9:02 PM, Jonathan S. Shapiro wrote:
>> One question about C# type variables arises. Is it legal for inner
>> declarations to "shadow" the type parameter name, as in:
>>
>>   static void f<A>(A x) {
>>     ....
>>     int A; // note this shadows the type parameter!
>>     ...
>>   }
>
> No, it's compiler error CS0412:
> http://msdn.microsoft.com/en-us/library/xe35chxa.aspx
>
>> Another: are the variable names in a CLI generic declaration
>> considered part of the type, or only their positions? That is: if we
>> rename the type parameter variables, are we making a new type?
>
> At the CIL level, only the type variable positions are used. They are
> also in a separate namespace using a !! prefix, similar to how you
> referred to ML type variables being in a separate namespace with a ' prefix.
>
> My vote goes for the ' or something equally distinct. C# has
> demonstrated that the angle bracket notation combined with simple
> letters and/or words, ie. <T>, makes nested generics a bit of a mess.
> The use of appropriate whitespace and syntactically distinct type
> variables is much easier to read.
>
> F# supports both notations, 'a and T [2], specified as ML-style "int
> list" or C#-style "list<int>" [1], although they suggest the ML notation
> only for built-in F# types [3].
>
> Sandro
>
> [1] http://msdn.microsoft.com/en-us/library/dd233215%28VS.100%29.aspx
> [2] From [1], "You can also make a function generic by using the single
> quotation mark syntax in a type annotation to indicate that a parameter
> type is a generic type parameter"
> [3] See "Note" section in [1]
>
> _______________________________________________
> bitc-dev mailing list
> [email protected]
> http://www.coyotos.org/mailman/listinfo/bitc-dev
>
>

_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to