Can vmodules provide functions with optional arguments?
mi+thun at aldan.algebra.com
Wed Oct 24 15:13:24 CEST 2012
On 24.10.2012 04:15, Tollef Fog Heen wrote:
>> The subject says it: can functions provided by a loaded module have
>> optional arguments?
> No, they can't. You could have it take a magic value like -1 or similar
> to signify "unset", though.
Thanks for the reply, Tollef. My goal was to make the vcl_recv be
smaller and easier to read, so, instead of using a magic value, I
renamed the actual function (which takes full set of arguments) into
foo_ex() and created a separate foo() -- which passes all the mandatory
arguments plus the default values for optional ones to foo_ex().
Still, I'd say, module-creation framework should some day support
optional arguments (supplying default values)...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the varnish-misc