Product Site

5.1.5.29. options

This method allows for querying and changing the package's current options at runtime, in addition to the static ::OPTIONS directive.

Sending the options message without an argument will return a string encoded as an ::OPTIONS directive denoting all the current settings of the package, e.g., "::OPTIONS DIGITS 9 FORM SCIENTIFIC FUZZ 0 NUMERIC NOINHERIT ERROR CONDITION FAILURE CONDITION LOSTDIGITS CONDITION NOSTRING CONDITION NOTREADY CONDITION NOVALUE CONDITION PROLOG TRACE NORMAL"

Sending the message options with one argument, the option argument, will return the current setting for that particular option. If a second argument is supplied, then the option will get set to that value, and the previous value is returned.

This method allows querying and changing the package settings (cf. ::OPTIONS). The changes take effect for the next invocation of a routine or method from the package.

The following option names in the first column can be used for the first argument, and the values in the second column can be used to change the setting. Note: Only the leading capitalized letters are needed; all characters following them are ignored.
optionnewValue
"All" (conditions)

"Condition", "Syntax": sets all condition related options
"Digits" (numeric setting)

E.g., "11" (a whole positive number, must be bigger than fuzz)
"Error" (condition)

"Condition", "Syntax"
"FAilure" (condition)

"Condition", "Syntax"
"FUzz" (numeric setting)

E.g., "3" (a whole number, must be smaller than digits)
"FOrm" (numeric setting)

"Engineering", "Scientific"
"InitialPackageSettings"

This option must not have a newValue argument! It merely returns a string encoded as an ::OPTIONS directive, representing the package settings before any override took place.
"Lostdigits" (condition)

"Condition", "Syntax"
"NOString" (condition)

"Condition", "Syntax"
"NOTready" (condition)

"Condition", "Syntax"
"NOValue" (condition)

"Condition", "Syntax"
"NUmeric" (numeric settings)

"Inherit", "Noinherit"
"Prolog"

"Noprolog", "Prolog"
"Reset"

This option must not have a newValue argument! Returns a string encoded as an ::OPTIONS directive, representing the package settings before resetting all options to the initial package settings.
"SetPackageSettings"

The argument must be a string encoded as an ::OPTIONS directive. This will also reset all options not listed in the string to their default values. Returns a string encoded as an ::OPTIONS directive, representing the package settings before setting them to the new values.
"Trace"

"All", "Commands", "Error", "Failure", "Intermediates", "Labels", "Normal", "Off", "Results"
"X" (eXplicitly set option)

This option must not have a newValue argument! Returns a blank-delimited string listing the package's explicitly defined options using the ::OPTIONS directive(s), i.e., one or more of "DIGITS", "FORM", "FUZZ", "NUMERIC", "ERROR", "FAILURE", "LOSTDIGITS", "NOSTRING", "NOTREADY", "NOVALUE", "NOPROLOG", "PROLOG", "TRACE".

E.g., if this subfunctions returns a string like "DIGITS TRACE", then the package defined explicitly an "::OPTIONS DIGITS xyz1" directive, an "::OPTIONS TRACE zyx1" directive, or a single "::OPTIONS DIGITS xyz1 TRACE zyx1" or "::OPTIONS TRACE zyx1 DIGITS xyz1" directive, where xyz1 denotes a whole positive number and zyx1 denotes one of the trace suboptions like A (for "trace all").

Example 5.47. Package class — options method
say .context~package~options
The output may be a string like:
::OPTIONS DIGITS 9 FORM SCIENTIFIC FUZZ 0 NUMERIC NOINHERIT ERROR CONDITION FAILURE CONDITION LOSTDIGITS CONDITION NOSTRING CONDITION NOTREADY CONDITION NOVALUE CONDITION PROLOG TRACE NORMAL


Note

It is possible to change the default package options for programs/packages that get loaded or required dynamically by taking advantage of defaultOptions (Class Method).