Nothing and type stability in kwargs

Yes, Julia allows specializing on keyword argument type. Constant propagation should work fine, too. Otherwise, report a bug.

What makes keyword arguments different than positional arguments is that keyword arguments are not dispatched on (modulo bugs: Keyword arguments affect methods dispatch · Issue #9498 · JuliaLang/julia · GitHub). So your code is fine.

That said, don’t overuse keyword arguments, as they add extra stack frames, which may cause bad performance in the presence of recursion or ugly stack traces in case of an error.

Stylistically, I prefer something like exit_steps isa Number or exit_steps isa Real.

3 Likes