Yet another "how to pass multiple parameters to a function" post

This should be inside your module, and the name of the struct should be public, probably exported. The user must create one instance of that struct, and pass it to the function.

In the example you are passing the type.

The function can or cannot set a default value for the parameters, with options::hypChan2020=hypChan2020() as a keyword or optional positional argument.

(This alternative is what I described here: How to allow users to safely change package "constants"? - #6 by lmiq)

3 Likes