Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1995
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1995

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Options and FilterOptions

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg961] Re: Options and FilterOptions
  • From: wagner at bullwinkle.cs.Colorado.EDU (Dave Wagner)
  • Date: Thu, 4 May 1995 03:34:14 -0400
  • Organization: University of Colorado, Boulder

In article <3nppkt$ohp at news0.cybernetics.net>,
Allan Hayes  <hay@haystack> wrote:
>
>Here are some general points about options and the function  
>FilterOptions that might be of use.
>
>1) Options can be of the form name:> value as well as name->value .
>So, one should normally use the form
>	foo[___, opts___?OptionQ]
>
>2) Nested list of options are accepted by OptionQ
>
>In[1]:=
>	OptionQ[{a->b,{{x :> y}}}]
>Out[1]=
>	True
>
>and by other functions: eg
>
>In[2]:=
>	Plot[x,{x,0,1}, {Frame ->True}];
>
>They can appear, or be generated, in code (though with care we  
>could probably avoid this).
>
>Unfortunately we find
> (92 lines of discussion deleted)

Alan,

  Thanks for pointing out that options could be specified as delayed
rules; I never would have thought of that.  In truth, I still can't
think of a case in which you'd want to specify an option that way *in a
function call* --- that is, I can see why one sometimes needs delayed
rules in Options[foo], but not in foo[___, opts].

  Judging from the discussion in your posting, using OptionQ introduces
a large number of potential problems.  The ability to pass lists of
options to built-in functions appears to be an undocumented feature; I
have never seen this before, and upon checking The Book I can't find
any mention of it.  So, I propose we apply the principle of Occam's
Razor and conclude that using OptionQ is too complicated to be "right."

  I therefore propose the following pattern for matching a sequence of
options:

	foo[___, opts:(_Rule | _RuleDelayed)...]

This does seem better than what I've been advocating, plus it avoids
all the "gotchas" that seem to be involved with nested lists of
options.  I don't think that users should complain that a function
doesn't support an undocumented feature.

  On the other hand, if you can point to anyplace that the lists-of-options
feature is documented, I'll eat these bits! :-)


		Dave Wagner
		Principia Consulting
		(303) 786-8371
		princon at csn.net
		http://www.csn.net/princon


  • Prev by Date: Re: Problem with LaplaceTransform (Help !)
  • Next by Date: Re: Tick marks on Axes AND Frame?
  • Previous by thread: Re: Options and FilterOptions
  • Next by thread: Re: Kernel configuration for DEC Alpha on VMS