1
votes

TL;DR: This question is about Prolog implementation details. Proceed at your own risk. You've been warned:)


According to ISO/IEC 13211-1995 "7.12 Errors":

7.12.2 Error classification

[...]

j) There may be a System Error at any stage of execution. The conditions in which there shall be a system error, and the action taken by a processor after a system error are implementation dependent. It has the form system_error.

[...]

NOTES

[...]

4 A System Error may happen for example (a) in interactions with the operating system (for example, a disk crash or interrupt), or (b) when a goal throw(T) has been executed and there is no active goal catch/3.

OK, but somewhat vague... So here's my actual question:

Are the following uses of system_error legitimate?

  1. Prolog system "L" does not offer modifiable character-conversion mappings. Instead, it behaves like this:

    current_char_conversion(X, Y) :-
       maplist(can_be(character), [X,Y]),
       false.                       % mapping unch.
    
    char_conversion(X, Y) :-
       maplist(must_be(character), [X,Y]),
       (  X == Y
       -> true                      % removal is OK
       ;  throw(error(system_error,
                      not_supported(char_conversion/2)))
       ).
    
  2. Prolog system "K" supports access-control lists for disallowing the use of some predicates during certain parts of the execution. Whenever such a predicate is invoked in a restricted part of the code, this happens:

    throw(error(system_error, disallowed(P/N)))
    

Can the Prolog systems "L" and "K" still be called "ISO-standard compliant"?

1

1 Answers

1
votes

Not an answer to your question on compliance but...

throw(error(system_error, disallowed(P/N)))

A permission error would make more sense here. But the possible values for the operation and permission type from the standard are not ideal. Maybe extending them and using something like e.g.

permission_error(call, predicate, P/N)

A resource_error/1 would also not be farfetched here.