j4n bur53 <
janb...@fastmail.fm> writes:
>But I am not sure whether this is really the
>intention of the standard. Would this apply to
>GNU Prolog in the following way:
>
> PCS GNU: 7-bit ASCII
> C GNU: 7-bit ASCII minus NUL Character
Yes, so it seems. That is: GNU processes the NUL character in a
Prolog text as a layout. This is *not* an implementation
specific extension, but just the choice of GNU for this
implementation defined feature.
If there is a "problem" with the standard, it is that this
C could - strictly speaking - be any subset of PCS, even one
that does not contain all characters from char (* 6.5 *) -
or even worse, no character at all (still a subset).
Always remember: Conformance does not guarantee that a
system is fit for any purpose. It is only a precondition.
> How can PCS be what is read, when C is what
> can be represented as a single character atom?
By implementing read/1 differently, not using get_char/1
or get_code/1.
> Does this mean that get_code can read it, and
> get_char cannot read it?
No. See in
7.1.4.1:
NOTE - There is a one-to-one mapping between members of
C (characters) and members of CC (character codes) (7.1.2.2).
But it means that read/1 might process it, whereas
get_code/1 *and* get_char/1 could not read it.
In GNU, the NUL is even accepted within a single
quoted atom (^@ denotes NUL)
g('ab^@cd').
which is read as
g('ab').
Strictly speaking, this is an implementation specific
extension of GNU.
In SICStus, any layout characters apart from a space is
correctly rejected in quoted atoms in Prolog text.