You are here

Future proofing the mxRun() function

3 posts / 0 new
Last post
mspiegel's picture
Joined: 07/31/2009 - 15:24
Future proofing the mxRun() function

Here is a proposed change to the mxRun() command. I've noticed that we have a tendency of adding flags to 'mxRun' as time marches forward. Currently, the signature for 'mxRun' is something like:

mxRun(model, flag1 = value1, flag2 = value2, flag3 = etc.).

The proposal is to change the signature to:

mxRun(model, <font size="+1" color="red">...</font>, flag1 = value1, flag2 = value2, flag3 = etc.)

The '...' arguments would not be used by the function. The purpose of the '...' arguments is to force any remaining arguments to be specified as named arguments. This will go a long way to ensure that future scripts will continue to run as new arguments are added to the 'mxRun' command. If any values are passed into the '...' arguments, then an error will be thrown. The R documentation for 'mxRun' will make it clear that the '...' argument is unused.

The alternative is to continue adding flags to 'mxRun' with default values, but new flags will always be added to the end of the function call. Adding new flags to the end of the call is consistent, but that prohibits the flags to be grouped according to their functionality (they are always sorted by date).

Steve's picture
Joined: 07/30/2009 - 14:03
The proposal seems very

The proposal seems very sensible to me.

neale's picture
Joined: 07/31/2009 - 15:14
Yes, to me too. Very

Yes, to me too. Very cunning.

Log in or register to post comments