Please explain fine point of splatting syntax in macros

This line in base/namedtuples.jl looks like

:( NamedTuple{$names,$types}(($(vals...),)) )

and I am asking about the

($(vals...),)

part. The , and the outer ()s seemed redundant to me, but if I omit them, the expansion does not work. What am I missing, what’s their role here?

Isn’t the comma just used to indicate a named tuple:

julia-1.0> x = (a = 1,)
(a = 1,)

julia-1.0> x = (a = 1)
1

(I’m still working out how these named tuples operate myself…)

Not only named tuples but distinguish any tuples from expression in parenthesis (if there is one element).

julia> (1)
1                                                                                 
                                                                                  
julia> (1,)
(1,)   

This would generate an arbitrary length Tuple inside an Expr objtect from an array of values of any length.

julia> :(($([1,2,3]...),))
:((1, 2, 3))

julia> :($(Tuple([1,2,3])))
(1, 2, 3)

Apparently, if you do it differently, then it is converted into a Tuple not wrapped in Expr object…