Altering file-variables

Official Description

6.5.5 It is an error to alter the value of a file-variable f when a reference to the buffer-variable f^ exists.

Simplified Description

According to ISO/IEC 7185 there are four ways of establishing a reference to a variable.

  1. Passing the variable by reference establishes a reference to the variable for the life of the function or procedure call.
  2. Using an assignment statement to assign a value to the variable, establishes a reference to the variable starting either before or after the expression on the right-hand side of the assignment statement is evaluated, and lasting until the value has been assigned to the variable.
  3. Using the variable in a with statement establishes a reference to the variable that exists during the execution of the statement in the with statement.
  4. Establishing a reference to a component of the variable, also establishes a reference to the variable as a whole.
So for example, it would be an error if you pass a file buffer by reference to a procedure and that procedure performs I/O on the file associated with the file buffer.

Error Handling

This error is never reported.