-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interface inheritance: use abstract types rather than symbols for optional components? #33
Comments
I agree that inheriting interfaces is a key ingredient (see our recent Discourse discussion). |
Yes its possible in the testing, but you don't get any traits to check that you passed it. The idea is that both tests and traits would be inherited automatically. |
@gdalle I just realised having inheritance for options means we have to define the |
I'm kind of keen on that change, because hypothetically large interfaces could even span several code files |
Sure, I guessed as much. But: how do we get the (You may need to choose nice layout or iheritance... or just move individual option functions to files and make all your options single lines calling those functions) |
If there's a choice I definitely go for inheritance. |
Each optional component would (hidden in the macro) define the abstract type like:
We could make it nicer looking, but that's the direct translation from what we have now
First we can just inherit the main interface
But we could also inherit the optional component, which itself inherits the interface:
We would test the interface by iterating over
supertype
until we hitAbstractInterface
then working backwards, so the basal interface is tested first. When@@implements
has multiple options, we would take theunion
of the interfaces to test at each step to avoid duplicating any tests..But... what we really want is a hack for multiple inheritance:
Where we would drop the real inheritance and instead write something like:
Then all tests and trait queries would recurse over
inherits(T)
if a trait is false forT
.The text was updated successfully, but these errors were encountered: