<@U0BDMQTHS>: &gt;as an example, requiring that a...
# language-proposals
g
@mikehearn:
as an example, requiring that a type has a constructor of a certain kind. or that it has a method which is not defined in an interface
worth mentioning, C# thought this was important enough for the case of a parameter-less constructor that they make a special exemption just for it,
Copy code
public void templatedMethod<T>() where T : new(), OtherInterface, SecondInterface //...
I used that feature once or twice, but I've put myself so throughly under the JVM's thumb that I simply avoid the need to interface constructors like the plague. In my experience so far, Factories + SAM + do-nothing-constructors has been perfectly satisfactory. It has once required me to use a type akin to the dreaded
Factory<Factory<Thing>>
--and actually, if you think of the
IEnumerable
Iterable
interface as being a factory, I suppose I've used
Factory<Factory<Factory<Thing>>>