|
|
|
|
|
by caseymarquis
1681 days ago
|
|
Haven't read the article yet. That can probably be padded over with some reflection. I don't really use F# (it's on the list of things to learn when my current job cools down a bit, doing 80 hours a week right now), but I use reflection in C# all the time. It's not too hard to iterate through all classes/functions/constructs in an assembly and create a cache. Additionally, the generic type parameters can be avoided by adding a parameter that looks like what you want to pull out. I'm on mobile, but you could make a library that does something like (excuse the C# syntax): Lib.Cache(assembly);
var myFunc = Lib.Pull(myFunc => async (int a, string b) => "");
That could throw an exception if there's a naming conflict and it's not able to find the function with only the name and signature. A second parameter could take part of a namespace/class name in that case. This is pseudo code, but I'm pretty sure I could get something similar up and running.Side note: If anyone is using F# and hiring, shoot me an email! |
|
It's possible but what's wrong with the generic type parameter? It's an unequivocal way of specifying of what type is expected on the other side.