Call function without Keywordarguments with an empty NamedTuple

Yes, you can!

test() = println("Hi") # no args no kwargs
kwargs = NamedTuple()
args = tuple()
test(args...;kwargs...)
# Hi

The difference with your code example is that I used ... which unpack the arguments. f(NamedTuple()) is reserved to mean a function with one argument that is a empty NamedTuple.

1 Like