Banjo

52 thoughts
last posted Nov. 9, 2015, 7:13 p.m.

42 earlier thoughts

0

The case for laziness

Laziness is required for certain things:

  1. Avoiding infinite loops/recursion using lazy control flow operations (even strict languages must provide lazy control flow)
  2. Defining cyclic dependencies - when two pieces of code depend on one another, one's reference to the other must be resolved a bit later. For example if we define a global true = lib.booleans.true and false = lib.booleans.false lazily then even the definitions of lib, lib.booleans, lib.booleans.true, and lib.booleans.false can use true and false. With call-by-need this is OK but it may not terminate in call-by-value or call-by-name scenarios.
  3. Slot expressions can refer to the object they are a slot on via their "self" binding. They can even refer to slots that are not yet defined - but which must later be defined in order for that slot to be defined at that time. Thus the value and defined-ness of a slot may depend on the value of self and its evaluation should be lazy.

9 later thoughts