This is more a curiosity than a real-world requirement. As an example to demonstrate what I mean by 'Controlling how an interface is implemented'..Say I wanted to implement a new task scheduler, and I exposed ways for the user to enqueue new work. The work adheres to some interface IWork.DoWork, or whatever. How can I ensure that the user doesn't spawn new threads within their implementation.Keep in mind, this is just an example, I'm not actually trying to implement a thread scheduler. I'm just looking for ways to control how an interface is implemented, if that's possible. I'm interested in examples from any language.Edit: To clarify, I'm looking for ways to restrict interfaces above and beyond what is normally allowed by function level interfaces. How do I implement IWork.DoAnythingExceptCreateNewThreads?
Patterns for controlling how an interface is implemented
design patterns;architectural patterns