Am 08.01.2018 um 11:59 schrieb Schaff, Frederik:

PS: A work-around is of course possible, like the following.

 

Work-Around:

function bundle get_defaults() #get a local copy of the defaults, can be used in a function if no options provided, or to create a local copy of the defaults bundle which then can be modified …

 

function void modify_defaults(bundle *local_defaults) #can modify a copy of local defaults

 

function plot(bundle input[null] “input”, string plot-type[null] “specify plot”, string output[null] “specify output name.type, default: display” bundle options[null] “local version of modified options, if wished for”) #if all is null, a help will be printed.


Exactly, this is the recommended way to do these things. Many of the larger function packages or add-ons use this kind of apparatus passing around a central bundle in pointer form.
Of course, this also comes at a price: Because everything is wrapped and hidden in the bundle, you don't see anymore in the function signatures which variables are actually needed, used, and modified. In order to compensate for this drawback, one needs extensive and thorough documentation.

cheers,
sven