|Did you know ...||Search Documentation:|
|Force only underscore to introduce a variable|
According to the ISO standard and most Prolog systems, identifiers
that start with an uppercase letter or an underscore are variables. In
the past, Prolog by BIM provided an alternative syntax, where
only the underscore (
_) introduces a variable. As of
SWI-Prolog 7.3.27 SWI-Prolog supports this alternative syntax,
controlled by the Prolog flag var_prefix.
As the character_escapes
flag, this flag is maintained per module, where the default is
false, supporting standard syntax.
Having only the underscore introduce a variable is particularly useful if code contains identifiers for case sensitive external languages. Examples are the RDF library where code frequently specifies property and class names27Samer Abdallah suggested this feature based on experience with non-Prolog users using the RDF library. and the R interface for specifying functions or variables that start with an uppercase character. Lexical databases where part of the terms start with an uppercase letter is another category were the readability of the code improves using this option.