I'd start with the keyword version, making sure to declare the type of each
keyword argument (in contrast with regular arguments, type declarations have a
performance impact for keyword arguments). Test your code. If you find this is
too slow, then switch to fixed-position arguments. You can define your function
like this:
function foo(x, bool1 = false, bool2 = false, bool3 = false)
body
end
and then the bool arguments will be optional. This will have no performance
penalty, but the caller needs to supply these bools in the proper order.
Best,
--Tim
On Monday, June 08, 2015 01:56:02 AM Scott Jones wrote:
> I have a function, originally from C, that I've now rewritten entirely in
> Julia.
> It takes a set of options, 3 currently, that determine what is done when
> certain types of poorly encoded UTF data is found.
> They are all just set or unset (true or false).
> Should they be keyword arguments?
> How should I do it so that julia can generate a version for the common case
> of no options set (i.e. not having the run-time checks on the options)?
>
> Thanks, Scott