next up previous

10.4 IMPORTING AND EXPORTING CONSTRUCTS

Unless specifically exported and imported, the constructs of one module may not be used by another module. A construct is said to be visible or within scope of a module if that construct can be used by the module. For example, if module B wants to use the foo deftemplate defined in module A, then module A must export the foo deftemplate and module B must import the foo deftemplate from module A.

CLIPS> (clear)
CLIPS> (defmodule A)
CLIPS> (deftemplate A::foo (slot x))
CLIPS> (defmodule B)
CLIPS> (defrule B::bar (foo (x 3)) =>)
[PRNTUTIL2] Syntax Error:  Check appropriate syntax for defrule
ERROR:
(defrule B::bar
   (foo (
CLIPS> (clear)
CLIPS> (defmodule A (export deftemplate foo))
CLIPS> (deftemplate A::foo (slot x))
CLIPS> (defmodule B (import A deftemplate foo))
CLIPS> (defrule B::bar (foo (x 3)) =>)
CLIPS>

CLIPS will not allow a module or other construct to be defined that causes two constructs with the same name to be visible within the same module.

10.4.1 Exporting Constructs

10.4.2 Importing Constructs



next up previous