Is this a bug? I somehow expected it to work. At least the error message could be improved (as no dictionaries are involved at any point). Should I open an issue?
julia> VERSION
v"1.2.0-DEV.219"
julia> nt = (a = 1, b = 2)
(a = 1, b = 2)
julia> map(((n, v),) -> "$n is $v", pairs(nt))
ERROR: map is not defined on dictionaries
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] map(::Function, ::Base.Iterators.Pairs{Symbol,Int64,Tuple{Symbol,Symbol},NamedTuple{(:a, :b),Tuple{Int64,Int64}}}) at ./abstractarray.jl:2049
[3] top-level scope at REPL[175]:1
# cf collecting before iteration
julia> map(((n, v),) -> "$n is $v", collect(pairs(nt)))
2-element Array{String,1}:
"a is 1"
"b is 2"