MathGroup Archive 2011

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

Search the Archive

Re: OptionsPattern[...]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118841] Re: OptionsPattern[...]
  • From: Sseziwa Mukasa <mukasa at gmail.com>
  • Date: Fri, 13 May 2011 06:24:47 -0400 (EDT)

On May 12, 2011, at 4:44 AM, Leonid Shifrin wrote:

> Sorry, but I disagree. Sending to a function options that don't belong to it is a bad programming style IMO. Even  if this works, this looks like an invitation for trouble. I think we all do this occasionally at our own risk, but I would not promote this as a programming practice.

Actually I agree with you.  I don't have a problem with the use of Sequence, but the original poster found it inelegant so I pointed out that it is unnecessary to filter the options for user defined functions.  If the function that uses a subset of the options of the calling function is hidden; as a private member of a package for example, it's not terrible not to filter the options, but the most correct option IMO is to filter the options and use Sequence.

> In fact, functions defined with OptionValue - OptionsPattern would give you error messages on unknown options passed to them (when you use OptionValue).

The messages can be suppressed, but that's even more inelegant IMO than using Sequence.

The problem with the original poster's request is that it is a quest for elegance for some imprecise definition of elegant.  The real deal breaker though is the fact that built-in functions can't be called the same way, which is a good reason not to pursue the idea any further.

Regards,
	Sseziwa


  • Prev by Date: Re: Mathematica handling of on where it saves current open notebook (again)
  • Next by Date: Re: How to select all cells in a notebook with specific property?
  • Previous by thread: Re: OptionsPattern[...]
  • Next by thread: Re: AxesLabel parallel to 3D axes?