3 ms·
Default argument variables create variadic functions. Arity N when you supply a value Arity N-1 when you use the default
by throwawaymaths 2y ago
Default argument variables create variadic functions.
Arity N when you supply a value
Arity N-1 when you use the default
- xigoi 2y agoOkay, but why could a static language not have variadic functions?
- throwawaymaths 2y agoThat's their design choice. I can think of a few reasons - makes function calling simpler - faster compilation - less symbol mangling - makes grepping for function implementation easier If for some reason you think you absolutely can't live without variadic functions, maybe don't use zig.
- Phil_Latio 2y agoHow does this create variadic functions? The arity is the same, since the function signature defines the exact amount of arguments. The compiler just passes the omitted ones for you.