11.3.94 goal_source_info/3

Synopsis

goal_source_info(+AGoal, -Goal, -SourceInfo)

Decompose the AGoal annotated goal into a Goal proper and the SourceInfo descriptor term, indicating the source position of the goal.

Arguments

AGoal
callable, must be nonvar
Goal
callable
SourceInfo
term

Description

Annotated goals occur in most of error message terms, and carry information on the Goal causing the error and its source position. The SourceInfo term, retrieved by goal_source_info/3 will be one of the following:

[]
The goal has no source information associated with it.
fileref(File,Line)
The goal occurs in file File, line Line.
clauseref(File,MFunc,ClauseNo,CallNo,Line)
The goal occurs in file File, within predicate MFunc, clause number ClauseNo, call number CallNo and virtual line number Line. Here, MFunc is of form Module:Name/Arity, calls are numbered textually and the virtual line number shows the position of the goal within the listing of the predicate MFunc, as produced by listing/1. Such a term is returned for goals occurring in interpreted predicates, which do not have “real” line number information, e.g. because they were entered from the terminal, or created dynamically.

Exceptions

instantiation_error
Goal is uninstantiated
type_error
Goal is not a callable

See Also

ref-msg.


Send feedback on this subject.