Under pure name equivalence:
Under structural equivalence:
passed by name:
passed by value:
passed by value result:
passed by reference
19 is printed. When we evaluate the first chunk of code, a block is created as assigned to B1. This block is a closure, and captures the temporary variables x and y. At this point x is 0 (after the final assignment), and y is 6. Note in particular that we don't simply copy the current value of x (namely 12) at the time the block is created; rather, we capture the binding of x, so that the subsequent assignment of 0 affects the block. When we evaluate the second chunk of code, another block is created and assigned to B2. This captures the temporary variables for that code, also named x and y, but which refer to different storage locations. Here x is 12 and y is 15. When we evaluate (B1 value: 3), this assigns 3 to the y in the first block, and returns 0+3 which is 3. When we evaluate (B2 value: 4), this assigns 4 to the y in the second block, and returns 12+4 which is 16. So the final result is 19.
equivalence
statement to direct the compiler to store a real
and an integer in the same storage location, so that the real number can be
accessed incorrectly as an integer and vice versa.
True
:=
and is a message to class Variable
.
False (although it's not a bad idea)
IF=5
is
a legal assignment statement. True