iso prolog - Which meanings of "type" are used in the standard? -


in part 1 of iso standard prolog, iso/iec 13211-1:1995, notion of "type" used refer different things. leads confusion. example, page called isoerrata (archived version, source) states (note page not related iso):

7.12.2 , 8.1.2.1

there confusion "type" is. there seem 3 different groups:

  • those listed in 8.1.2.1 , occur validtypes in type_error terms in 7.12.2.b
  • those listed in 8.1.2.1 , occur validdomain in domain_error terms in 7.12.2.c
  • those listed in 8.1.2.1

in addition, there validdomains in 7.12.2.c not listed in 8.1.2.1, presumably mistake (eg. io_mode).

8.14.3.3.f

the template requires type atom_or_atom_list 3rd argument, strangely required error term here type_error(list,operator). 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) more appropriate (but note atom_or_atom_list not among validtypes listed in 7.12.2!). eclipse have therefore opted type_error(list,op) if op improper list, , type_error(atom,op) if op other non-atom.

so in meanings "type" used, , above confusion?

there 3 different uses "type" in iso/iec 13211-1:

  1. types defined in 7.1 types. these are: variable (7.1.1), integer (7.1.2), floating point (7.1.3), atom (7.1.4), compound term (7.1.5) , types based on them. next 2 uses refer 7.1 or terminology (3 definitions) definition. important here, variables included. classification motivated prolog's syntax:

    7.1 types

    the type of term determined abstract syntax (6.1.2).

  2. types defined in 7.12.2 b. these types used in type errors of form type_error(validtype, culprit). note variables no longer included since these either signaled instantiation errors (7.12.2 a) or uninstantiation errors (7.12.2 k, cor.2).

    validtype ∈ { atom, atomic, byte, callable, character, compound, evaluable, float, in_byte, in_character, integer, list, number, pair, predicate_indicator }

  3. types used in template , modes subclause:

    8.1.2.1 type of argument

    the type of each argument defined 1 of following atoms: atom, atom_or_atom_list, atomic, byte, callable_term, character, character_code, character_code_list, character_list, clause, close_options_list, compound_term, evaluable, flag, head, in_byte, in_character, in_character_code, integer, io_mode, list, nonvar, number, operator_specifier, predicate_indicator, read_options_list, source_sink, stream, stream_options_list, stream_or_alias, stream_position, stream_property, term, write_options_list

above quote mentioned 7.12.2 , 8.1.2.1 , how relate each other. needs more elaboration:

types of 7.12.2 reported type errors. types in 8.1.2.1 serve in template , modes subclause of definition of built-in. not per se suited used errors. in concrete definition of built-in predicate, there subclause x.y.z.2 template , modes , x.y.z.3 errors. here examples of types of 8.1.2.1 (bold in list above).

write_options_list

there no direct one-to-one correspondence between write_options_list , concrete types used in errors. instead, type list , domain write_option used. complex type write_option_list never signaled:

8.14.2.2 template , modes

write_term(@stream_or_alias, @term, @write_options_list)

8.14.2.3 errors

...

c) options neither partial list nor list
type_error(list, options).

...

e) element e of options list neither a
variable nor valid write-option
domain_error(write_option, e).

atom_or_atom_list

this more complex. on 1 hand atom list expected, atom fine. have list , atom relevant types:

8.14.3.2 template , modes

op(+integer, +operator_specifier, @atom_or_atom_list)

8.14.3.3 errors

...

f) operator neither partial list nor list nor an
atom
type_error(list, operator).

g) element e of operator list neither a
variable nor atom
type_error(atom, e).

it equally plausible produce atom error f. on other hand, both errors equally applicable, , list best malformed lists [a|nonlist], whereas atom not better 111 might ocr error of [l].

callable_term

the corresponding type error contains callable. in

8.10.1.2 template , modes

findall(?term, +callable_term, ?list)

8.10.1.3 errors

...

b) goal neither variable nor callable term
type_error(callable, goal).

in_character_code

there neither corresponding type in 7.12.2 b, nor domain in 7.12.2 c. in 7.12.2 f defined representation errors:

8.12.1.2 template , modes

...
get_code(?in_character_code)
get_code(@stream_or_alias, ?in_character_code)

8.12.1.3 errors

...

j) code integer not in-character code
(7.1.2.2)

representation_error(in_character_code).

io_mode

this is listed in 8.1.2.1, contrary quoted text. appears in 7.12.2 c , used:

8.11.5.3 errors

...

h) mode atom not input/output mode
domain_error(io_mode, mode).

character_code_list

similar write_options_list. however, erroneously mentioned in 7.12.2 c. that's error in standard has been removed in cor.3:2017.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -