sclass LazyVar implements IVar, ISetter { *() {} *(A *v) {} *(IF0 *f) {} IF0 f; // will keep var around after the fact (we could change this by counting how many threads are waiting) Var> calculating; A v; public A get() { bool meCalc; synchronized { meCalc = calculating = null; if (meCalc) calculating = new Var; } if (meCalc) { OKOrError b = okOrError(() -> f!); calculating.set(b); synchronized { ret v = b!; } } else { try { waitUntilNotNull(calculating); ret a; } } } public synchronized bool has() { ret v != null; } public synchronized void clear() { v = null; } toString { ret str(this.get()); } !include #1023196 }