MirrorMirror: Working on the generics API
Yesterday I finished the basic invokation API for MirrorMirror. Now I want it to start supporting generic methods. Since the current API uses params object[] for the parameters, I don’t know how to add the type parameters to that. I want to avoid the usage of generics in the API, because several times you will be dealing with internal types, so you can’t add them as a type parameter.
One idea I have is to change the current, simple API:
var result = object.Invoke("Method", arg1, arg2);
to
var result = object.Member("Method").Invoke(arg1, arg2);
so I can add method to that chain to support generics:
var result = object.Member("Method").Generic( type1, type2).Invoke(arg1, arg2);
Following this schema, I can always give support to the first API, but it will only work for non generic methods.
Also I would like to add support to generic types inference, so if you have a method with this signature:
private string MyGenericMethod<T1,T2>( T1 a, T2 b)
{
...
}
you can call it without specify the type parameters.
I will be working on this in the following days and will post the final thoughts.
