This document is an attempt to look at all issues that might be part of the next corrigendum. (The numbering of items changes, when new items are inserted, so please always refer to the content in addition to the number)
3.146 read-option: A compound term with uninstanti-Does this mean that every read-option even as an extension has to have uninstantiated arguments? How many such arguments? Augments?
ated * arguments which amplifies the results produced
by the built-in predicate read-term/3 (8.14.1) and the
bootstrapped * built-in predicates based on it (see 7.10.3).
3.206 write-option: A ground term that controls the output produced by the built-in predicate write_term/3 (8.14.2) and its bootstrapped * built-in predicates (see 7.10.4, 7.1.4.2).Reconsider this for variable_names/1.
A processor may support the value of an expression being a value of an additional type instead of an exceptional value.to
A processor may support the value of an expression being some value including a value of an additional type instead of an exceptional value or error.Illustrative example from IF, SWI, YAP:
?- X is (1 rdiv 2) - (1 rdiv 2), integer(X). X = 0.This could be controversial and definitely needs an explicit resolution!
is/2
by (is)/2
.
5.5.12 Input/output.
A processor may support one or more additional stream options (7.10.2.11), stream close options (7.10.2.12), stream properties (7.10.2.13), read options (7.10.3) and write options (7.10.4) as an implementation specific feature.
A term which is the name - followed directly by a numericWhat means "directly" and what is a "numeric constant". 6.1.2 c and d defined them - they have no sign. A numeric constant is either an integer constant (* 6.4.4 *) or a float number token (* 6.4.5 *). There is even a separate Note in 6.4.5 to insist that a float number token is unsigned.
constant denotes the corresponding negative constant.
Compatibility:
integer(- /**/ 1).
: Succeeds in B, Ciao, IF, Minerva,
SICStus, YAP, XSB, GNU (new!). Fails in
ECLiPSe, GNU, SWI.
History:
term = name, integer ; term = name, float number ;The nonterminals
integer
and float number
are defined in 6.4 Tokens. Thus, both permit an optional layout text
sequence.
integer (* 6.4 *) = [ layout text sequence (* 6.4.1 *) ] , integer token (* 6.4.4 *) ; float number (* 6.4 *) = [ layout text sequence (* 6.4.1 *) ] , float number token (* 6.4.5 *) ;Would it have been intended to disallow spaces between
-
and the numeric constant, then the rules in 6.3.1.2 would have been:
term = name, integer token ; term = name, float number token;Further, the Prolog text
- 1.
cannot be misread as a
compound term (-)/1, because in 6.3.4.2 Operators as functors, the
minus sign is explicitly excluded.
term = op, term ; Abstract: f(a) f a Priority: n n n Specifier: fy Condition:If a is a numeric constant, f is not - Condition:The first token of a is not open ct lterm = op, term ; Abstract: f(a) f a Priority: n n n-1 Specifier: fx Condition:If a is a numeric constant, f is not - Condition:The first token of a is not open ct
(',')/2
name token
: Replace
| semicolon token (* 6.4.2 *) | cut token (* 6.4.2 *) ;by
| graphic solo token (* 6.4.3 *) ;(@@@ Also update 6.1.2 b 3)
semicolon token (* 6.4.2 *) = semicolon char (* 6.5.3 *) ; cut token (* 6.4.2 *) = cut char (* 6.5.3 *) ;by
graphic solo token (* 6.4.2 *) = graphic solo char (* 6.5.3 *)
solo char
:
Replace
= cut char (* 6.5.3 *)by
= graphic solo char (* 6.5.3 *)Delete line
| semicolon char (* 6.5.3 *)Replace definitions
cut char (* 6.5.3 *) = "!" ; semicolon char (* 6.5.3 *) = ";" ;by
graphic solo char = "!" | ";" ;or by
graphic solo char = cut char | semicolon char ;
p text = ;by
p text = [ layout text sequence (* 6.4.1 *) ] ;(Restrictions on the layout: 6.4.8 end char)
term
and read term
is defined in (* 6.2.2 *) but
also in (* 6.4 *). The definition in 6.4 defines it as a sequence of
tokens. E.g., ")." whereas
3.148 defines it as a term followed by an end token.
single line comment
: A single line comment ends
with a new line char
or with EOF (@@@ better formulation
needed!)
3.140 Prolog data: A sequence of read-terms (seeMaybe extend this by followed by an optional layout sequence (???).
6.2.2).3.141 Prolog text: A sequence of read-terms denoting
directives and clauses (see 6.2, 7.4).
An end char shall be followed by a layout character or %.by
An end char shall be followed by a layout character, %, or it shall be the last character.
dependent
replace
by defined
. But: horizontal tab char is not strictly
needed. See 6.4.2.1. A control escape sequence...
Similarily replace 7.10.2.6
followed by an implementation dependent new line character (6.5, 6.5.4).
a) If T is not a variable and unifies with ^(_, G) then ...alternatively
a) If T has the form ^(_, G) then ...
domain_error(non_empty_list, [])
be defined?
The format and notation of the definition of each controlIt is not clear, why
construct is consistent with that used for built-in predicates
(8.1) except that a modegoal
indicates that the argument
is a goal rather than a term.
goal
is called a mode. It is type
and mode at the same time, in addition it indicates arguments where
cuts cut to the outside. It indicates arguments that are converted to
a goal. (Maybe its only a mode and no type, because there are no type
errors associated?)
This is the case for 7.8.5.2, 7.8.6.2, 7.8.7.2, 7.8.8.2, but not for 7.8.3.2 and 7.8.9.2.
is
in ['throw(X)'iscauses a goal
E is -(-(_)).
should result in an instantiation error. Subclause a vs. b. This
leads to ambiguities in 5.5.10 extensions. Consider a new evaluable
functor zero/1 such that 0 is zero(_). The argument shall be ignored.
Due to subclause b this would be an instantiation error. but zero(-_)
would be no instantiation error.
Even worse:
X is 1/0+_. X is _+1/0.These examples should never produce a zero_divisor, since subclause b is always "faster" than subclause a. But all systems produce that error.
eof_action(Action)
:
GNU and B is fine, SICStus: wrong error, SWI, YAP: ignored.error
— There shall be a Permission Error
(7.12.2 e) signifying that no more input exists in this stream.
variable_names(VN_list)
in analogy to
the read-option variable_names(VN_list)
.
Systems supporting this option are MINERVA (Manual dated 1997-06-22 (c) 1996-2009, local copy), Jekejeke, GNU, B, YAP, SWI, SICStus.
7.10.4 add:
variable_names(VN_list)
— Each variableV
is written with a variable nameA
iff a termA = V
is an element of the listVN_list
. If there are multiple elementsA = V
, the leftmost element is the one which applies.
variable_names(VN_list)
any instance (3.95) of the corresponding read-option is well defined.
pre-a) IfTerm
is a variable and there is an effective write-optionvariable_names(VN_list)
and there is an elementA = Term
of the listVN_list
withA
an atom representing a valid variable name, thenA
is output with effective write-optionquoted(false)
.
the sequence of characters forming the atom followed by a layout character could not be input as a valid atom.Alternatively, a dot at the end (without a layout char and without a %) is an end token only.
Alternatively, replace in 6.4.2 Names:
A graphic token shall not be the single character . (dot)by
when . is followed by a layout char or single line
comment.
A graphic token shall not be the single character . (dot)6.4.8 other tokens. Replace
when . is followed by a layout char or single line
comment or when . is the last character
An end char shall be followed by a layout character or aby
%.
An end char shall be followed by a layout character or a
% or it shall be the last character
Term
has the
form '$VAR'(N)
for some pos-e2) Else ifTerm
has the form'{}'(Arg)
, and there is an effective write-optionignore_ops(false)
, thenTerm
is output as a curly bracketed term (6.3.6), that is:
- 1)
{
(open curly char) is output- 2)
Arg
is output by recursively applying these rules- 3)
}
(close curly char) is output
h) If Term
has a principal functor ...
by Else if
h) If Term has a principal functor which is an
operator, and there is an effective write-option
ignore_ops(false), then the term is output in operator
form, that is:1) The atom of the principal functor is output
in front of its argument (prefix operator), between
its arguments (infix operator), or after its argument
(postfix operator). In all cases, a space is output
to separate an operator from its argument(s) if any
ambiguity could otherwise arise.
2) Each argument of the term is output by recursively
applying these rules. When an argument is itself
to be output in operator form, it is preceded by (
(open char) and followed by ) (close char) if: (i) the
principal functor is an operator whose priority is so
high that the term could not be re-input correctly with
same set of current operators, or (ii) the argument is
an atom which is a current operator.
2) Each argument of the term is output by recursively applying these rules. An argument is preceded by ( (open char) and followed by ) (close char) if: (i) the principal functor is an operator whose priority is so high that the term could not be re-input correctly with the same set of current operators, or (ii) the argument is an atom which is a current operator, or (iii) the principal functor is output as a prefix operator - and the argument is a positive number, or (iv) the principal functor is output as a prefix operator - and the argument is to be output in infix or postfix operator form.
If the value of this flag is false, inte-This should probably be a resource error. Integers, as defined as type (7.1) in (7.1.2) are accompanied with Note 1 which suggest a resource error "because of exhaustion of resource".
ger arithmetic is always performed correctly (ex-
cept when there is a system_error),
NOTE - The possible values are required to be -M or -(M+1) where M is the value of the flag max_integer.In 13211-1 1.1 Notes it is defined that "Notes in this part of ISO/IEC 13211 have no effect on the language, Prolog text or Prolog processors that are defined as conforming to this part of ISO/IEC 13211". Reasons are only cross references and warnings for differences to existing implementations. This note has however a very strong effect on an implementation. For this reason it should be accompanied with a cross reference towards 7.1.2.
PermissionType ∈ { binary_stream flag,
type_error(evaluable,unbound)
when Prolog flag
bounded is false.
e) Constructs the clause with headReplace byH
and bodyB
,
G
.
b) the goal succeeds.
put_char(my_file, C). If a stream is associated with my_file instantiation_error. put_char(st_o, 'ty'). If a stream is associated with st_o type_error(character, ty). put_code(my_file, C). If a stream is associated with my_file instantiation_error. put_code(st_o, 'ty'). If a stream is associated with st_o type_error(integer, ty).
put_byte(my_file, C). If a stream is associated with my_file instantiation_error.
by
- k) Parses
C_Seq
as a read-term (6.4)T.
,
- k) Parses
C_seq
as a read-term (6.2.2)T.
,
- e) An element
E
of theOptions
list is neither a
variable nor a valid write-option
—domain_error(write_option, E).
write_term(1,[quoted(nonbool)]). domain_error(write_option,quoted(nonbool)) write_term(1,[quoted(B)]). domain_error(write_option,quoted(_))The second case seems to be particularly problematic because a further instantiation would make this goal succeed.
B = true, write_term(1,[quoted(B)]). Succeeds, outputting the character 1.
type_error(list, Operator)
.
atom_or_list
or atom_or_atom_list
.
8.1.2.1 has type atom_or_atom_list
. There is also a type
character_list
. atom_or_list
is simpler,
but then it is nowhere used. (This would affect also 7.12.2 b!).
Alternatively it might be preferable to
issue type_error(atom,Xs)
to "advertise" that one does
not need a list.
type_error(list, Operator)
. The
actual type should be changed to atom_or_atom_list
.
a character sequence of Number
which could be output
(7.10.5 b, 7.10.5 c).
But the procedural description:
So the declarative description is not true for "01", while the procedural description succeeds. There are many other examples of that kind.
- b) Else parses the list of the characters of the name of the one-char atoms according to the syntax rules for numbers and negative numbers (6.3.1.1, 6.3.1.2) to give a value N,
Maybe add a new subclause:
Additionally is true, ifNumber
unifies withN
obtained by 8.16.7.1 b.
VX
is negative and Y is not. Replace
by VY
.