Best formalism to define the interface
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- julia
- Domain
- api, backend-api-design
Research direction
Start by reviewing the proposed interface choices in this issue and the referenced Graphs.jl pull request #262. Compare the methodless-function and default-error approaches, along with the linked Interfaces.jl and InterfaceSpecs.jl options. Done means the maintainers agree on and document the formalism for the new API.
Written by the indexing model from the issue text.
Description
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):
julia> function myfunc1 end
myfunc1 (generic function with 0 methods)
julia> myfunc2(args...) = error("Not implemented")
myfunc2 (generic function with 1 method)
julia> myfunc1(1)
ERROR: MethodError: no method matching myfunc1(::Int64)
Stacktrace:
[1] top-level scope
@ REPL[4]:1
julia> myfunc2(1)
ERROR: Not implemented
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] myfunc2(args::Int64)
@ Main ./REPL[2]:1
[3] top-level scope
@ REPL[5]:1
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?
- Dominant language
- Julia
- Stars
- 11
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from JuliaGraphs/GraphsBase.jl
-
Constructors for 2.0Openquestion
Difficulty 5/5 Over a week Newbie friendliness 25/100
JuliaGraphs/GraphsBase.jl#34 ·
-
question
Difficulty 5/5 Over a week Newbie friendliness 15/100
JuliaGraphs/GraphsBase.jl#28 ·
-
question
Difficulty 5/5 Over a week Newbie friendliness 25/100
JuliaGraphs/GraphsBase.jl#27 · 1 comment · 1 reaction ·
-
question
Difficulty 5/5 Over a week Newbie friendliness 22/100
JuliaGraphs/GraphsBase.jl#26 · 6 comments · 2 reactions ·
-
question
Difficulty 5/5 Over a week Newbie friendliness 25/100
JuliaGraphs/GraphsBase.jl#25 · 3 comments · 1 reaction ·
All issues in JuliaGraphs/GraphsBase.jl
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
JuliaStats/LogExpFunctions.jl#134 · 2 comments ·
-
code bug PowerSystems 6.0
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Sienna-Platform/PowerSystems.jl#1849 ·
Maintainers usually reply within 7 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
FluxML/Metalhead.jl#407 ·
Maintainers usually reply within 1 day