A context error occurs when a goal or declaration appears in the wrong place.
There may or may not be anything wrong with the goal or declaration as such;
the point is that it is out of place. Calling multifile/1
as a goal is a
context error, as is having :-module/2
anywhere but as the first term in a
source file.
The exception code associated with a context error is
context_error(Goal, ContextType, CommandType)
Some ContextTypes recognized by the system include:
'pseudo-file ''user'''
-- for pseudo-file 'user'
if
-- inside an if
bof
-- at beginning of file
bom
-- at beginning of module
query
-- in query
before
-- before
'after clauses'
-- after clauses
'not multifile and defined'
-- for defined, non-multifile procedure
'static multifile'
-- for static multifile procedure.
language(
L)
-- for language L.
file_load
-- during load of file(s).
started
-- started up
notoplevel
-- when no top level
Some CommandTypes recognized by the system include:
0
-- no commandtype specified
cut
clause
declaration
'meta_predicate declaration'
use_module
'multifile assert'
'module declaration'
'dynamic declaration'
meta_predicate(
M)
-- meta_predicate declaration for M
argspec(
A)
-- Invalid argument specification A
foreign_file(
File)
-- foreign_file/2
declaration for File
foreign(
F)
-- foreign/3
declaration for F
(initialization)
-- initialization hook
abort
-- call to abort/0