I didn't say the stream option encoding/1 is in ISO
core standard. I gave links to SWI-Prolog and SICStus
Prolog, that one can provide encoding/1 (bom/1 and
buffer/1 come also to mind) stream options in a
Prolog system. You only find in the ISO core standard:
ISO/IEC 13211-1 First edition 1995-06-01
7.10.2.11 Options on stream creation - Page 57
A processor may support one or more additional
Options as an implementation specific feature.
The only minimal stream options documented
by the ISO core standard are type/1, reposition/1,
alias/1, eof_action/1. Whereby Jekejeke Prolog
even doesn't implement eof_action/1 as a creation
option. In Jekejeke Prolog the terminal can produce
multiple EOF interleaved with text (like reset?), while
ordinary streams only produce text and then EOF
forever (like eof-code?). Exceptions need to be
thrown on the application level in Java, when dealing
with streams. At least this is the case for most of
the basic streams, not sure how coders react. But my
ScannerToken and PrologReader don't do an over peeking,
so they don't read past EOF. Otherwise the terminal
would not function, and you could not do the following:
Jekejeke Prolog 2, Runtime Library 1.2.6
(c) 1985-2018, XLOG Technologies GmbH, Switzerland
?- [user]
foo
^D /* <--- this is an EOF input, CTRL-D */
?- foo
Yes
If your O-Prolog console would use some eof_action(reset)
stream, you could also provide such a user interface, instead
of the (?-)/1 directive. Although the (?-)/1 is very original
invention, its slightly confusing when somebody is used
to the other mode, implemented by most Prolog systems. The
other mode is based on the availability of eof_action(reset)
streams. That the input and output are such streams is
seen in a table of the ISO core standard.
Table 40: Properties of standard streams.
Table 40 defines the properties of the Standard streams.
But since I want to keep the number of aliases low,
I am also not compatible here. The current result is:
Jekejeke Prolog 2, Runtime Library 1.2.6
(c) 1985-2018, XLOG Technologies GmbH, Switzerland
?- stream_property(user_output, X).
Error: No such stream alias user_output.
stream_property/2
?- current_output(X), stream_property(X,Y), write(Y), nl, fail; true.
reposition(false)
file_name() /* according to table 40, ISO core, I should show that */
mode(write) /* according to table 40, ISO core, it should read append */
buffer(4096) /* implementation specific */
bom(false) /* implementation specific */
encoding(UTF-16) /* implementation specific */
output
type(text)
Yes
/* according to table 40, ISO core, alias is missing */
/* according to table 40, ISO core, eof_action is missing */