-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Should vararg keyword arguments be returned as Pair
?
#15737
Comments
It would also be nicer if |
|
See https://github.com/eschnett/SimpleAssoc.jl for a package that shows how an |
There's already an ImmutableDict in base as an implementation detail of some recent output refactoring, I don't think it's exported though Lines 935 to 950 in c45175f
|
Hmm: There is ImmutableDict{K,V}(KV::Pair{K,V}) = ImmutableDict{K,V}(KV[1], KV[2]) but: julia> typealias D Base.ImmutableDict{Char,Int}
Base.ImmutableDict{Char,Int64}
julia> D('a'=>1)
ERROR: MethodError: Cannot `convert` an object of type Pair{Char,Int64} to an object of type Base.ImmutableDict{Char,Int64}
This may have arisen from a call to the constructor Base.ImmutableDict{Char,Int64}(...),
since type constructors fall back to convert methods.
Closest candidates are:
convert{T}(::Type{T}, ::T)
(::Type{BoundsError})(::ANY)
(::Type{BoundsError})(::ANY, ::ANY)
...
in Base.ImmutableDict{Char,Int64}(::Pair{Char,Int64}) at ./sysimg.jl:48
in eval(::Module, ::Any) at /Users/eschnett/julia05nt/lib/julia/sys.dylib:-1 Apparently needs a few tests... |
that's an outer constructor, and works as intended:
|
In https://github.com/eschnett/FlexibleArrays.jl , I used the names |
Dup of #4916. |
With
there is
It might be nicer if the tuple
(:x,1)
was aPair
instead.The text was updated successfully, but these errors were encountered: