Next: , Previous: , Up: Revision History   [Contents]


13.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, in addition to what is said in What Is New In Release 4 (read that first!), this section provides further 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-inReplaced by
    get0/[1,2], get/[1,2]get_code/[1,2], get_byte/[1,2]
    ttyget0/1, ttyget/1get_code/2, get_byte/2
    put/[1,2], tab/[1,2]put_code/[1,2], put_byte/[1,2]
    ttyput/1, ttytab/1put_code/2, put_byte/2
    skip/[1,2]skip_code/[1,2], skip_byte/[1,2]
    ttyskip/1skip_code/2, skip_byte/2
    ttynl/0nl/1
    ttyflush/0flush_output/1
    fileerrors/0, nofileerrors/0set_prolog_flag/2
    'C'/3unification
    call_residue/2call_residue_vars/2
    undo/1call_cleanup/2
    help/0the message system
    version/0the message system
    version/1the message system
    fcompile/1save_files/2
    load/1load_files/2
    load_foreign_files/2splfr + load_foreign_resource/1
    require/1use_module/2
    is_mutable/1mutable/1
    module/1set_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 in the SICStus Prolog Manual.
  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 release 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 moduleClosest equivalentComment
    arraysarrays3a
    assocassoc3b
    charsiocodesioc
    clpfdclpfdd
    listslists3e
    queuesqueues3f
    randomrandom3g
    socketssocketsd
    systemsystem3h
    termstermsd

    Comments to the table:

    1. library(arrays3) is a code migration library module; the long-term solution is to use library(logarr) 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 release 3 version is that exec/3 returns a process reference, a compound term, instead of an integer process identifier.



Send feedback on this subject.