2.12 Environment Control (Prolog flags)
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Overview
        • Environment Control (Prolog flags)
          • current_prolog_flag/2
          • set_prolog_flag/2
          • create_prolog_flag/3
    • Packages
Availability:built-in
[ISO]set_prolog_flag(:Key, +Value)
Define a new Prolog flag or change its value. Key is an atom. If the flag is a system-defined flag that is not marked changeable above, an attempt to modify the flag yields a permission_error. If the provided Value does not match the type of the flag, a type_error is raised.

Some flags (e.g., unknown) are maintained on a per-module basis. The addressed module is determined by the Key argument.

In addition to ISO, SWI-Prolog allows for user-defined Prolog flags. The type of the flag is determined from the initial value and cannot be changed afterwards. Defined types are boolean (if the initial value is one of false, true, on or off), atom if the initial value is any other atom, integer if the value is an integer that can be expressed as a 64-bit signed value. Any other initial value results in an untyped flag that can represent any valid Prolog term.

The behaviour when Key denotes a non-existent key depends on the Prolog flag user_flags. The default is to define them silently. New code is encouraged to use create_prolog_flag/3 for portability.