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:
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 END
Compiles without errors. Should it?