|Did you know ...||Search Documentation:|
#define(Macro, Expanded) :- Body. is, after some
basic sanity checks, translated into a rule
'$macro'(Macro, Var), Body => Var = Expanded.
#import(File) is translated into
:- use_module(File, )
link clause that links the macro expansion from the module
File to the current module.
Macro expansion is realised by creating a clause for term_expansion/2
in the current module. This clause results from expanding the first
#import definition. Thus, if macros
are defined before any other local definition for term_expansion/2
it is executed as the first step. The macro expansion fails if no macros
were encounted in the term, allowing other term_expansion rules local to
the module to take effect. In other words, a term holding macros is not
subject to any other term expansion local to the module. It is subject
to term expansion defined in module
that is performed after the local expansion is completed.