# Copyright 2004 Hewlett Packard, Inc. under the terms of the MIT X license # found at http://www.opensource.org/licenses/mit-license.html ................ ? def makeLazySlot := # value: ? makeLazySlot :DeepFrozen # value: ? # Normal > def &foo := makeLazySlot(fn { println("foof"); "food" }) # value: ? (&foo).isFinal() # value: true ? (&foo).put("mood") # problem: this lazy Slot may not be changed ? foo # stdout: foof # # value: "food" ? foo # value: "food" ? # Throwing by maker > def &bar := makeLazySlot(fn { println("barn"); throw("bare") }) # value: ? bar # stdout: barn # # problem: bare ? bar # problem: bare ? # Ejecting by maker > def baz; escape out { bind baz := makeLazySlot(fn { out("bass") }); baz.get() } # value: "bass" ? baz.get() # problem: nonlocal exit by lazy slot's maker