Using LET Inside Procedures
Date: 2020-10-07 18:10:00

Up | Next | Prev | PrevTail | Tail

### 15.4 Using LET Inside Procedures

By using LET instead of an assignment in the procedure body it is possible to bypass the call-by-value protection. If X is a formal parameter or local variable of the procedure (i.e. is in the heading or in a local declaration), and LET is used instead of := to make an assignment to X, e.g.

let x = 123;

then it is the variable that is the value of X that is changed. This eﬀect also occurs with local variables deﬁned in a block. If the value of X is not a variable, but a more general expression, then it is that expression that is used on the left-hand side of the LET statement. For example, if X had the value p*q, it is as if let p*q = 123 had been executed.

Up | Next | Prev | PrevTail | Front