Closed Mercerenies closed 3 years ago
deflazy
is implemented as of d310c48 (with a partial fix for #56 implemented in bfa7f47). The rest of #56 is a known bug which will be dealt with over in that issue.
This issue will remain open until defobject
is converted to deflazy
as well.
e430d1d converts defobject
to be a macro which uses deflazy
, thus closing this issue.
I propose a new construct
deflazy
.deflazy
has a name and an expression. The expression is lazily initialized the first time the name is referenced.compiles to a nullary function which initializes the value if needed, and then returns it. We can use the same construction we used for
defobject
here. Additionally, once we havedeflazy
,defobject
could be defined as, roughly,