9.2 Guide to Porting Code from Release 3

Release 4 does not provide a mode in which it is 100% compatible with earlier releases. However, this section provides guidelines for migrating Prolog code from release 3 to release 4.

  1. First of all, make sure that your code runs in ISO execution mode. In release 3, the command line option --iso can be used.
  2. A number of built-in predicates have been dropped. They are listed in the table below, along with their approximate substitutes. Refer to the documentation for each case.

    Dropped built-in Replaced by


    get0/[1,2], get/[1,2] get_code/[1,2], get_byte/[1,2]


    ttyget0/1, ttyget/1 get_code/2, get_byte/2


    put/[1,2], tab/[1,2] put_code/[1,2], put_byte/[1,2]


    ttyput/1, ttytab/1 put_code/2, put_byte/2


    skip/[1,2] skip_code/[1,2], skip_byte/[1,2]


    ttyskip/1 skip_code/2, skip_byte/2


    ttynl/0 nl/1


    ttyflush/0 flush_output/1


    fileerrors/0, nofileerrors/0 set_prolog_flag/2


    'C'/3 unification


    call_residue/2 call_residue_vars/2


    undo/1 prolog:undo/1


    help/0 the message system


    version/0 the message system


    version/1 the message system


    fcompile/1 save_files/2


    load/1 load_files/2


    load_foreign_files/2 splfr + load_foreign_resource/1


    require/1 use_module/2


    is_mutable/1 mutable/1


    module/1 set_module/1
  3. The hook predicates user:term_expansion/[2,4] and user:term_expansion/3 are now called user:term_expansion/6 and Module:term_expansion/5 and have a modified API; see Term and Goal Expansion.
  4. The set of library modules has been enriched by incorporating a subset of the Quintus Prolog library modules that we have deemed useful.

    library(clpb), library(clpq) and library(clpr) are provided but not supported. library(flinkage) and library(spaceout) are not included in SICStus 4. library(objects) has been replaced by its Quintus counterpart, with a completely different API.

    The following table lists the affected SICStus 3 library modules.

    Affected module Closest equivalent Comment


    arrays arrays3 a


    assoc assoc3 b


    charsio codesio c


    clpfd clpfd d


    lists lists3 e


    queues queues3 f


    random random3 g


    sockets sockets d


    system system3 h

    Comments to the table:

    1. library(arrays3) is a code migration library module; the long-term solution is to use library(logarrs) instead.
    2. library(assoc3) is a code migration library module; the long-term solution is to use library(avl) instead.
    3. The syllable `chars' has been changed to `codes' throughout.
    4. Several API changes; see the documentation.
    5. library(lists3) is a code migration library module; the long-term solution is to use library(lists) instead.
    6. library(queues3) is a code migration library module; the long-term solution is to use library(queues) instead.
    7. library(random3) is a code migration library module; the long-term solution is to use library(random) instead.
    8. library(system3) is a code migration library module; the long-term solution is to use library(system), library(file_systems) and library(process) instead.

      One difference between library(system3) and the original SICStus Prolog 3 version is that exec/3 returns a process reference, a compound term, instead of an integer process identifier.


Send feedback on this subject.