Directives for using code in other files

Author(s): Daniel Cabeza.

Documentation for the directives used to load code into Ciao Prolog (both from the toplevel shell and by other modules).

Usage and interface

  • Library usage:
    These directives are builtin in Ciao, so nothing special has to be done to use them.

Documentation on internals

DECLARATION

Usage: ISO:- ensure_loaded(File).

  • Description: Specifies that the code present in File will be included in the executable being prepared, in the user module. The file File cannot have a module declaration. This directive is intended to be used by programs not divided in modules. Dividing programs into modules is however strongly encouraged, since most of the attractive features of Ciao (such as static debugging and global optimization) are only partially available for user modules.
  • The following properties should hold at call time:
    (streams_basic:sourcename/1)File is a source name.

DECLARATION

Usage: ISO:- include(File).

  • Description: The contents of the file File are included in the current program text exactly as if they had been written in place of this directive.
  • The following properties should hold at call time:
    (streams_basic:sourcename/1)File is a source name.

DECLARATION
:- use_package(Package).

Specifies the use in this file of the packages defined in Package. See the description of the third argument of module/3 for an explanation of package files.

This directive must appear the first in the file, or just after a module/3 declaration. A file with no module declaration, in the absence of this directive, uses an implicit package default (see Other predicates and features defined by default).

Usage 1: :- use_package(Package).

  • The following properties should hold at call time:
    (streams_basic:sourcename/1)Package is a source name.

Usage 2: :- use_package(Package).

  • The following properties should hold at call time:
    (basic_props:list/2)Package is a list of sourcenames.