Naming positional arguments at call site

Is this true? Certainly Julia 0.6 or something had slow keywords, but I think that (in almost all cases?) this was fixed long ago.

All the examples here show no cost for me. As do simple tests… including ones which rely on constant propagation:

julia> fun(; x, y) = fun(x, y); fun(x, y) = /(x, y);  # very simple fast function

julia> @btime fun(x=$1, y=$2); @btime fun($1, $2);
  min 2.500 ns, mean 2.610 ns (0 allocations)
  min 2.458 ns, mean 2.583 ns (0 allocations)

julia> tup(n) = sum(ntuple(i -> i^2, n)); tup(; n) = tup(n);

julia> @btime tup(5); @btime tup($5); @btime tup(n = 5); @btime tup(n = $5);
  min 0.875 ns, mean 0.957 ns (0 allocations)
  min 15.071 ns, mean 15.269 ns (0 allocations)
  min 0.834 ns, mean 0.957 ns (0 allocations)
  min 15.071 ns, mean 15.306 ns (0 allocations)

julia> @code_warntype tup(5)  # Tuple{Vararg{Int64}}, without constant propagation!
5 Likes