-
Notifications
You must be signed in to change notification settings - Fork 1
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
Best formalism to define the interface #2
Comments
I have been looking at RequiredInterfaces.jl which seems like an option as well. Given that the Graphs interface is quite complex, I am in favour of using some interface package to check for correct implementations. RequiredInterfaces.jl also adds a |
Yeah since I opened this issue I experimented with RequiredInterfaces and was very satisfied. I would love to see it in action here, plus the customer support I got from the lead dev was top notch. |
I'm also curious as to whether traits are actually needed or not. Some are used for dispatch, like |
Regarding drawbacks of traits: |
When we define the new API, there will be abstract types with some methods that must be implemented. In base Julia, I see two main ways of specifying this (as in, defining the function name, possibly with a generic docstring):
I believe a methodless function is better than a single method throwing an error by default. The end result is nearly the same in terms of user experience, but I find the first error clearer because it directly tells you what to implement. @simonschoelly what do you think?
Of course we could also consider more advanced options like Interfaces.jl or InterfaceSpecs.jl but maybe it's a bit overkill?
See also: JuliaGraphs/Graphs.jl#262
The text was updated successfully, but these errors were encountered: