NamedTuples.jl icon indicating copy to clipboard operation
NamedTuples.jl copied to clipboard

Convenient syntax for merging

Open davidanthoff opened this issue 9 years ago • 1 comments

It would be great if the folllowing syntax would work for merging NamedTuples:

nt1 = @NT( a=>1, b=>2, c=>3 )
nt2 = @NT( d=>4, e=>5)
@NT(nt1..., f=>"something else",nt2...)

would construct a NamedTuple (a=>1,b=>2,c=>3,f=>"something else",d=>4,e=>5).

davidanthoff avatar Aug 21 '16 17:08 davidanthoff

@JeffBezanson I tried to implement this by starting to make merge of NamedTuples type stable, but I'm running into julialang/julia#16806. Currently one can't use the @NT macro in the quoted expression of a generated function on julia 0.5 because the @NT macro calls eval to create the type for the named tuple, but using eval inside a generated function throws an error in julia 0.5 (not on 0.4). Any chance that regression might get resolved at some point?

davidanthoff avatar Sep 03 '16 05:09 davidanthoff