<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="">&nbsp; // Type of the property.</div><div class=""><div class="">&nbsp; associatedtype Value</div></div><div class="">&nbsp; // Storage required by the property.</div><div class=""><div class="">&nbsp; var storage: Value? { get set }</div></div><div class=""><div class="">}</div></div><div class=""><div class="">extension delayedImmutable {</div></div><div class="">&nbsp; // Implementation of the property.</div><div class=""><div class="">&nbsp; var value: Value {</div></div><div class=""><div class="">&nbsp; &nbsp; // The property can only be read after it's been initialized.</div></div><div class=""><div class="">&nbsp; &nbsp; get {</div></div><div class=""><div class="">&nbsp; &nbsp; &nbsp; guard let theValue = storage else {</div></div><div class=""><div class="">&nbsp; &nbsp; &nbsp; &nbsp; fatalError("delayedImmutable property read before initialization")</div></div><div class=""><div class="">&nbsp; &nbsp; &nbsp; }</div></div><div class=""><div class="">&nbsp; &nbsp; &nbsp; return theValue</div></div><div class=""><div class="">&nbsp; &nbsp; }</div></div><div class=""><div class="">&nbsp; &nbsp;&nbsp;</div></div><div class=""><div class="">&nbsp; &nbsp; // The property can only be written once to initialize it.</div></div><div class=""><div class="">&nbsp; &nbsp; set {</div></div><div class=""><div class="">&nbsp; &nbsp; &nbsp; guard storage == nil else {</div></div><div class=""><div class="">&nbsp; &nbsp; &nbsp; &nbsp; fatalError("delayedImmutable property rewritten after initialization")</div></div><div class=""><div class="">&nbsp; &nbsp; &nbsp; }</div></div><div class=""><div class="">&nbsp; &nbsp; &nbsp; storage = newValue</div></div><div class=""><div class="">&nbsp; &nbsp; }</div></div><div class=""><div class="">&nbsp; }</div></div><div class=""><div class=""><br class=""></div></div><div class="">&nbsp; // Initialization logic for the property storage.</div><div class=""><div class="">&nbsp; static func initStorage() -&gt; Value? {</div></div><div class=""><div class="">&nbsp; &nbsp; return nil</div></div><div class=""><div class="">&nbsp; }</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>