Prolog /
IsoErrataAdditional notes on ISO-Prolog standardAuthor: Joachim Schimpf; Last modified: August 13, 2017, at 05:30 PM Corrigendum 2 (2012)9.3.10 (^)/2 - integer power [fixed in corrigendum 3]The definition of error case 9.3.10.3.e misses cases like
— type_error(float, VX). The 6th example was not covered by any of the original error cases. With the correction, it is covered by (e) and should read: 2^(-1). type_error(float,2). The definition of error case 9.3.10.3.d should ideally be
— evaluation_error(zero_divisor). because this is the case where an infinite result is defined. Note that the same applies to the (**)/2 function in the core. Type 'float' should be added to ValidTypes in 7.12.2.b. Core Standard 13211-1 (1995)3.168, 7.1, 7.12.2 and 8.1.2.1 Types and domainsThere is some confusion about what a type and a domain is. A type is initially defined as one of atom, integer, floating point, variable or compound term (3.168 and 7.1), but a different, more complex notion is used in the later sections. The notion of domain is used, but not explicitly defined. Section 8.1.2.1. lists 34 argument types, which are the ones used in predicate templates. These fall into 3 different groups:
In addition, there are ValidTypes in 7.12.2.b that do not occur in 8.1.2.1 (callable, compound), and ValidDomains in 7.12.2.c that are not listed in 8.1.2.1 (eg. prolog_flag). The systematics is unclear, e.g. why there is a distinction between compound and compound_term, or why a byte is a type, but not_less_than_zero is a domain. The type character_code_list is a ValidDomain, but there is no such domain error. 8.14.3.3.f op/3The template requires the type atom_or_atom_list for the 3rd argument, but strangely the required error term here is type_error(list,Operator). This results in (see examples) op(30,xfy,0) =====> error(type_error(list,0)) where type_error(atom,0) or type_error(atom_or_atom_list,0) would be more appropriate (but note that atom_or_atom_list is not among the ValidTypes listed in 7.12.2!). For ECLiPSe we have therefore opted for type_error(list,Op) only if Op is an improper list, and type_error(atom,Op) if Op is any other non-atom. 8.14.4 current_op/3There should be extra errors
8.8.2.3 and 8.9.4.3 current_predicate/1 and abolish/1These take the same argument type, but error reporting is much more detailed in abolish/1. 8.17 set_prolog_flag/2 [fixed in corrigendum 3]The example displays a 9.1.4 Floating Point OperationsThe division 9.3.1.3.d (**)/2Raising zero to a negative power should give zero_divisor rather than undefined because an infinite result is defined. 9.3.6.3.c log/1The error case should be split into an undefined case only when VX is negative, and a zero_divisor case corresponding to the infinite result when VX is zero. 9.3.10.3.d (^)/2The definition of error case should be
— evaluation_error(zero_divisor). because this is the case where an infinite result is defined. Analogous to the (**)/2 function. Questions
|