[Previous] [Next] [Contents]

## `combinat::warnDeprecated` -- issue of warnings when deprecated features are used

#### Introduction

`combinat::warnDeprecated` controls whether deprecated functions such as `combinat::powerset` issue warnings.

#### Call(s)

`combinat::warnDeprecated()`
`combinat::warnDeprecated(mode)`

#### Parameters

`mode` | - | `TRUE` or `FALSE`

#### Returns

the (former) setting of the switch

#### Details

- The `combinat` library in MuPAD 2.5 is a major rewrite compared to MuPAD 2.0. Several functions or features known from earlier versions are considered deprecated and only forward calls to the corresponding new functions. After ``combinat::warnDeprecated`(TRUE)` is invoked, each such call will issue a warning.

- ``combinat::warnDeprecated`(TRUE)` turns on those warnings, ``combinat::warnDeprecated`(FALSE)` switches them off, and ``combinat::warnDeprecated`()` returns the current setting.

- The warnings are turned on by default when the MuPAD-Combinat package is explicitly loaded by the user. Otherwise, the default setting is initialized from the value of `Pref::warnChanges()`.

#### Related Functions

`Pref::warnChanges`

#### Example 1

The function `combinat::powerset` is deprecated. By default, it simply forwards to `combinat::subsets::list`:

    >> combinat::warnDeprecated(FALSE):
       combinat::powerset({a,b,c})

              {{}, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}

If you plan to adjust your code to future MuPAD versions, you should switch on the warnings about deprecated functions and change all such calls to their new versions:

    >> combinat::warnDeprecated(TRUE):
       combinat::powerset({a,b,c})

          Warning: combinat::powerset is obsolete.
          Please use 'combinat::subsets' and 'combinat::subwords' instea\
          d. [combinat::powerset]

              {{}, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}

#### Example 2

Here, we show how to temporarily switch on or off the warnings, and to restore the previous state afterward:

    >> oldval := combinat::warnDeprecated(FALSE):
       combinat::partitions(4);
       combinat::warnDeprecated(TRUE):
       combinat::partitions(4);
       combinat::warnDeprecated(oldval):

                                         5
          Warning: combinat::partitions(n) is obsolete.
          Please use 'combinat::partitions::count(n)' instead. [combinat\
          ::partitions::new]

                                         5

[Previous] [Next] [Contents]

MuPAD Combinat, an open source algebraic combinatorics package