I have seen functions defined without argument values, just types for dispatch as so:
function foo(::Int, n)
return Int(n)
end
First question: What is this type-only argument style called? I can’t seem to find its documentation.
Second question: Is there a way to call such a function without passing a value for the first argument? In principle, something like foo(::Int, 4)
could be possible (but I’m not sure if it’s supported or considered somehow unjulian).
Thanks!
8 posts - 4 participants