<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">If anyone wants to start playing with the feature, I now have some of the core functionality working in a branch:<div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><a href="https://github.com/apple/swift/pull/1297" class="">https://github.com/apple/swift/pull/1297</a></div></blockquote><div class=""><br class=""></div><div class="">I didn't want to waste time parsing a behavior declaration syntax while we're still painting the bikeshed, so behaviors are currently exposed as protocols with extension methods following a convention:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div class="">protocol delayedImmutable {</div></div><div class=""> // Type of the property.</div><div class=""><div class=""> associatedtype Value</div></div><div class=""> // Storage required by the property.</div><div class=""><div class=""> var storage: Value? { get set }</div></div><div class=""><div class="">}</div></div><div class=""><div class="">extension delayedImmutable {</div></div><div class=""> // Implementation of the property.</div><div class=""><div class=""> var value: Value {</div></div><div class=""><div class=""> // The property can only be read after it's been initialized.</div></div><div class=""><div class=""> get {</div></div><div class=""><div class=""> guard let theValue = storage else {</div></div><div class=""><div class=""> fatalError("delayedImmutable property read before initialization")</div></div><div class=""><div class=""> }</div></div><div class=""><div class=""> return theValue</div></div><div class=""><div class=""> }</div></div><div class=""><div class=""> </div></div><div class=""><div class=""> // The property can only be written once to initialize it.</div></div><div class=""><div class=""> set {</div></div><div class=""><div class=""> guard storage == nil else {</div></div><div class=""><div class=""> fatalError("delayedImmutable property rewritten after initialization")</div></div><div class=""><div class=""> }</div></div><div class=""><div class=""> storage = newValue</div></div><div class=""><div class=""> }</div></div><div class=""><div class=""> }</div></div><div class=""><div class=""><br class=""></div></div><div class=""> // Initialization logic for the property storage.</div><div class=""><div class=""> static func initStorage() -> Value? {</div></div><div class=""><div class=""> return nil</div></div><div class=""><div class=""> }</div></div><div class=""><div class="">}</div></div></blockquote><div class=""><div class=""><br class=""></div></div><div class="">Custom accessors and initializer expression bindings aren't handled yet, but there's enough there now to implement `delayed` initialization. Here's an example test case:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><a href="https://github.com/jckarter/swift/commit/9da36f8e1e45564a61da4cfc9ed5327bf57862df" class="">https://github.com/jckarter/swift/commit/9da36f8e1e45564a61da4cfc9ed5327bf57862df</a></div><div class=""><br class=""></div></blockquote>-Joe</body></html>