one option might be to define both with- and without-keywords versions and then call the without from the with:
f(x; t) = f(x, t) f(x::Int, t::Int) = ... f(x::Number, t::Number) = ... but you may need some logic to set default values (zero() and one() may be useful). On Tuesday, 30 June 2015 09:51:37 UTC-3, Linus Härenstam-Nielsen wrote: > > As I understand it keyword arguments aren't affected by multiple dispatch, > I'm guessing it is a performance decition but it means you can run into the > following situation: > > > f(x::Int; t::Int=0) = t > > f(x::Number; t::Number=1) = t > > f(1, t=1.0) > > ERROR:TypeError:f:intypeassert, expected Int64, got Float64 > > That is, the first method is used even though the second would be > appropriate if t was accounted for. Is there a standard way of dealing with > this? I am working with a function with several keyword arguments and it > has me stuck. >
