bit of context:
I have an Add function in Schéma that can be fed various types and performs the right operation using a TypeSwitch. This way a few hardcoded types can be supported. I’m adding the functionality to register operations for more exotic types if needed.
For this I’m using the RegisterService of IVLFactory and TryGetService with a simple IAddService interface which basically just defines an Object Add(Object a, Object b).
As many of these AddServices will just be performing a + or Concat operation on different types I thought I might use a Generic implementation whose type would be defined during the RegisterService call.
This should be all that’s needed but now there is no way to tell the compiler which type I want to instance - an equivalent of new GenericConcatAddService<Spread> in C# basically.
Something like this (or maybe something using ConstrainTypes) will work but requires each instance of this Class to hold an instance of the type that’s being added - which is not ideal.
I propose adding the option to expose points in a patch as Type inputs that could be defined externally. Although I guess this might have to bubble upwards if more such nodes are nested together… and most probably some other caveats.
I guess this is a fairly niche feature, covering cases when the automatic type inference is not enough, but maybe there is some usefulness to it?