-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Description
During JuliaCon discussion with @ahojukka5, I figured it would be cool to have NamedTuple unpacking in function arguments which honors the names of the named tuple. Currently we have:
julia> nt = (a=1, b=2)
julia> f((b,)) = b
f (generic function with 1 method)
julia> f(nt)
1
instead, I'd think this would be more intuitive:
julia> f(nt)
2
Similarly it could work for structs:
julia> struct A; a; b end
julia> aa = A(1,2)
A(1, 2)
julia> f(aa)
2
(Unfortunately, this needs a 2.0 label)
Edit: fixed unneeded/confusing default-value method-defs.
Gnimuc, JLTastet, CameronBieganek, fredcallaway and inokawazu
Metadata
Metadata
Assignees
Labels
No labels