-
Notifications
You must be signed in to change notification settings - Fork 14
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
Request - unpack with default values #17
Comments
I'm not sure. Shouldn't this be the duty of the type? Or, what does it mean to get a value from a type which doesn't have that value defined? For this you could just define a getproperty function. |
I might like this as well, for unpacking keyword arguments:
In the above example, I would like to have The use case is that I have a I can do this manually with one |
Doesn't that work already: julia> solve(;s1 =1, kwargs...) = solve_m1(;s1=s1, kwargs...)
solve (generic function with 1 method)
julia> solve_m1(;s2=6, kwargs...) = @show kwargs
solve_m1 (generic function with 1 method)
julia> solve()
kwargs = Base.Iterators.Pairs(:s1 => 1)
pairs(::NamedTuple) with 1 entry:
:s1 => 1
julia> solve(a=1)
kwargs = Base.Iterators.Pairs(:s1 => 1, :a => 1)
pairs(::NamedTuple) with 2 entries:
:s1 => 1
:a => 1 (at least mostly) |
Would it be possible to add a feature to allow unpacking with optional default values?
The text was updated successfully, but these errors were encountered: