December 2021
Beginner
840 pages
47h 29m
English
We demonstrate how to modify the Camille interpreter supporting pass-byreference from Section 12.4 so that it supports pass-by-name/need. To implement lazy evaluation in Camille, we extend the Reference data type with a third target variant: a thunk target. A thunk is the same as a direct target, except that it contains a thunk that evaluates to an expressed value, rather than containing an expressed value:
Note that we added frozen_expr flag to the dictionary of possible target types.
If the dereference function is passed a reference containing a thunk, it evaluates ...