I do understand, the ;
for keyword parameter separation and the ...
(which is both the slurping and the splatting operators) are often confusing for someone that has not seen them before in other languages.
I do want to point out, however, that ;
is rarely needed for keyword argument/parameters separation: only when the function has only keyword parameters and they are passed by splatting that they are truly needed. Otherwise, Julia allows both ‘,’ and ‘;’ to separate keyword arguments/parameters, and most people use ‘,’. I use ‘;’ because of stylist preferences and because I preferred the language to have never have allowed ‘,’ in this context and sticked to ‘;’.
Adding to the previous code, if I have at least one positional parameter I can write:
julia> f(x, color = :black, markersize = 1) = @show x, color, markersize
f (generic function with 4 methods)
julia> f("abc", merge(attribute_set_A, attribute_set_B)...)
(x, color, markersize) = ("abc", :red, 2)
("abc", :red, 2)
The ...
splatting operator is basically a: “do not treat this as one container object with multiple elements inside but instead as all the elements were there outside any container”.
I think the manual sections you want are:
- https://docs.julialang.org/en/v1/manual/faq/#The-two-uses-of-the-…-operator:-slurping-and-splatting – FAQ section that confirms many beginners find
...
confusing. - Keyword arguments – The manual section on keyword arguments.