Recent Changes - Search:

PmWiki

pmwiki.org

edit SideBar

IsoErrata

Additional notes on ISO-Prolog standard

Author: 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 2^-1, and unnecessarily covers cases like -1^-2. It should be changed to

e) VX and VY are integers, the absolute value of VX is greater than 1, and VY is negative

— 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

d) VX is zero and VY is negative

— 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 domains

There 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:

  • Those that are listed in 8.1.2.1 and also occur as ValidTypes in type_error terms in 7.12.2.b
  • Those that are listed in 8.1.2.1 and occur as ValidDomain in domain_error terms in 7.12.2.c
  • Those that are listed in 8.1.2.1 only (head, clause, ...)

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/3

The 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/3

There should be extra errors

  • type_error(integer) if Priority is neither a variable nor an integer
  • type_error(atom) if Op_specifier is neither a variable not an atom

8.8.2.3 and 8.9.4.3 current_predicate/1 and abolish/1

These 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 domain_error(flag, date), while 8.17.1.3.d requires the domain prolog_flag.

9.1.4 Floating Point Operations

The division 0/0 should give an undefined result rather than zero_divisor.

9.3.1.3.d (**)/2

Raising zero to a negative power should give zero_divisor rather than undefined because an infinite result is defined.

9.3.6.3.c log/1

The 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 (^)/2

The definition of error case should be

d) VX is zero and VY is negative

— evaluation_error(zero_divisor).

because this is the case where an infinite result is defined. Analogous to the (**)/2 function.

Questions

  • is there consensus about the effect of catch((B=foo,throw(bar)),B,true). Is it uncaught or succeeds with B=bar? Uncaught in SWI and ECLiPSe (up to 6.1). With incremental stack unwinding (which ECLiPSe will probably have in the future), the natural behaviour is success.
Edit - History - Print - Recent Changes - Search
Page last modified on August 13, 2017, at 05:30 PM