[Remind-Fans] optional arguments to functions
Dianne Skoll
dianne at skoll.ca
Sun Jul 5 11:36:52 EDT 2020
On 2020-07-03 15:07, Ian! D. Allen wrote:
> Any easy way to allow functions to have missing arguments that default
> to empty?
No, but I also don't really see a compelling use-case for this.
Because a Remind function body can only be an expression, it's
pretty awkward to deal with optional arguments; you'd have to wrap
every occurrence in an iif() function. Also, I don't think
non-supplied optional arguments should default to the empty string;
I think we should add a NULL type for this case. And finally, if
I did add this, people would want a way to supply default values
for omitted arguments... something like:
FSET _foo(x, y=1, z="default") ...
which I don't feel like implementing.
You could always work around it:
FSET _Foo(x) iif(x, x, "noarg")
FSET _Foo2() _Foo("")
Regards,
Dianne.
More information about the Remind-fans
mailing list