You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider when you get a keyword argument wrong you currently get a plain MethodError.
This does highlight that the keyword argument was wrong,
but it could be made better.
In particular, we could use our fuzzy search to find similar names.
e.g.
right now we get
julia>foo(; bar=1) =1
foo (generic function with 1 method)
julia>foo(; bars=2)
ERROR: MethodError: no method matching foo(; bars::Int64)
Closest candidates are:foo(; bar) got unsupported keyword argument "bars"
@ Main REPL[6]:1
Stacktrace:
[1] kwerr(kw::@NamedTuple{bars::Int64}, args::Function)
@ Base ./error.jl:165
[2] top-level scope
@ REPL[7]:1
We could be saying did you mean "bar"?
This is more helpful when there is a lot of keyword arguments.
And we could probably just list the top 3 by fuzzy distance.
Though this will not work for any function that takes varadic keyword arguments, which I suspect is most common for things with many many keyword arguments.
The text was updated successfully, but these errors were encountered:
Consider when you get a keyword argument wrong you currently get a plain MethodError.
This does highlight that the keyword argument was wrong,
but it could be made better.
In particular, we could use our fuzzy search to find similar names.
e.g.
right now we get
We could be saying
did you mean "bar"?
This is more helpful when there is a lot of keyword arguments.
And we could probably just list the top 3 by fuzzy distance.
Though this will not work for any function that takes varadic keyword arguments, which I suspect is most common for things with many many keyword arguments.
The text was updated successfully, but these errors were encountered: