Is there any trick to handle optional arguments in Julia? Sometimes I want to setup some of the arguments of a function for the user, however; this setup is not necessarily straightforward that I could just pass a default value in a keyword argument. Consider the function below:
function f(; b=nothing) if b != nothing # assertions to make sure b is of the right type end println(b) end
If the user specifies
b, I need to assert its type, but it seems that I am reinventing the wheel here. There is probably a better way of handling this situation? I was thinking of something like
Nullable in Julia v0.6, but I am not very familiar with it. In C++, I would use Boost.Optional.