[Mono-devel-list] On the way to make S.R.E generics API more usable

Kamil Skalski nazgul at nemerle.org
Thu Apr 7 11:11:25 EDT 2005


Hi!

On my work towards implementing generics emission in Nemerle I get into 
following problems:

- MS is adding new methods to TypeBuilder for obtaining members of 
instanciated generic types:

    public static MethodInfo GetMethod (Type instanciated, MethodInfo meth)
    public static ConstructorInfo GetConstructor (Type instanciated, 
ConstructorInfo cons)
    public static FieldInfo GetField (Type instanciated, FieldInfo fld)

see 
http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=d507aff5-b1e3-49b4-8178-065a00d2f15e
they are already available in Feb CTP, though not documented anywhere.

  And not suprisingly, I need them... I hacked something in mono sources, so 
it is partially enough for my experiments now, but it would be nice to have 
it implemented correctly.
  I'm not sure what would be the *correct* way of implementing it. I tried 
iterating on instanciated.GetMethods (), but comparing if member signatures 
match isn't that easy (for example GetParameters () method sometimes throws 
exception when used for TypeBuilder)
  Any suggestions?

- There is a new MakeGenericType method in TypeBuilder, which simply replaces 
BindGenericTypes, which gets obsoleted (attached patch to add this method to 
TypeBuilder)

- I need the HasGenericArguments method from TypeBuilder, which currently in 
mono is "throw NotImplementedException" - attached patch to make it simply 
check for presence of generic_params.

Kamil Skalski
-------------- next part --------------
A non-text attachment was scrubbed...
Name: make_generic_type.diff
Type: text/x-diff
Size: 460 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050407/744df94e/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: has_generic_arguments.diff
Type: text/x-diff
Size: 467 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050407/744df94e/attachment-0001.bin 


More information about the Mono-devel-list mailing list