Yeah that makes sense. I was suggesting something more like the following:
Interface designer:
- Define the generic functions related to the interface
- Use a single macro to define the trait and specify all of the functions of the interface
Implementer:
- Define the type
- Extend the functions
- Assign the trait (and get an error if all of the functions aren’t extended)
The advantages I see to this would be that the API no longer gives a way to add functions to the interface from anywhere in the code other than where the interface is defined, which I think is not something you would really want people to do. Additionally you don’t have to manually check whether you implemented everything properly, because the API just throws an error when you go to apply the trait if you didn’t.
Obviously you can’t actually stop anyone from messing with the internals and applying traits to things that don’t meet the interface requirements or adding more functions to the interface, but the API could not provide a convenient way to do so.