Re: Transparently passing on options to other functions
- To: mathgroup at smc.vnet.net
- Subject: [mg82303] Re: [mg82227] Transparently passing on options to other functions
- From: Sseziwa Mukasa <mukasa at jeol.com>
- Date: Wed, 17 Oct 2007 04:02:41 -0400 (EDT)
- References: <200710160716.DAA08428@smc.vnet.net>
On Oct 16, 2007, at 3:16 AM, Art wrote:
>
> Let functions f and g be defined as follows:
>
> f[ OptionsPattern[{}] ] := OptionValue[optf];
>
>
> Options[g] = {optg -> True};
> g[opts : OptionsPattern[]] := OptionValue[optg] && f[opts]
>
> The following gives a warning that optf is not an option value for
> function g.
>
> g[optg -> False, optf -> False]
>
>
> Is there a good way to have OptionValue ignore this fact and not
> generate
> a warning? What is the proper way to transparently pass through
> options to
> other functions?
>
> I would like to not do the following:
>
> Options[g] = {optg -> True, optf -> Null};
>
> which eliminates the warning.
The warning is valid, if g is to pass on options to f then f's
options must necessarily be a subset of g's. Define g's options
appropriately.
Regards,
Ssezi
- References:
- Transparently passing on options to other functions
- From: Art <grenander@gmail.com>
- Transparently passing on options to other functions