I've seen people define types for options. Maybe you could use

type FunctionOptions{T, U, V}
end

Where T, U, V are bools. You could then define your function like

function f(mainarg, optionarg = no_options_set)
   ...
end

where 'no_options_set' is an object of type FunctionOptions that represents 
the default case of the user having provided no options.

I think this would also allow you to use a generated function to move all 
option-checks to compile time, if you wanted to.


On Monday, June 8, 2015 at 4:56:02 AM UTC-4, 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
>
>

Reply via email to