Methods of POINTER TO RECORD with CONST receiver still allowed to change receiver's fields
I was told (but have not confirmed) that receiver fields should be read-only with the following declarations, but they are not:
MODULE M;
TYPE Reader = POINTER TO RECORD r: Files.Reader; eof: BOOLEAN END;
PROCEDURE (r: Reader) ReadByte (VAR b: UNSIGNED8); (* receiver is CONST
by default, right? *)
VAR ch: CHAR;
BEGIN r.r.Char(ch); r.eof := r.r.res # Streams.Ok; IF ~r.eof THEN b :=
SYSTEM.VAL (UNSIGNED8, ch) END
END ReadByte;
END M.
Compiles without errors. Should it?
(from redmine: issue id 107, created on 2021-01-02 by root)