<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Joe,&nbsp;<div class=""><br class=""></div><div class="">I’m wondering if you missed my comments. &nbsp;I had a few questions I haven’t seen answered yet so I’m bumping them.&nbsp;</div><div class=""><br class=""></div><div class="">-Matthew</div><div class=""><br class=""><div>The proposal makes it clear when an initializer is <b class="">required</b>&nbsp;but is a little bit less clear about when it may be left off. &nbsp;Is this correct?<br class=""><font color="#5856d6" class=""><br class=""></font>var [baseProp] x // no initializer, ok as long as base doesn't have init req?<br class="">var [initializerReqt] y // no initializer, error because of the initializer requirement?<br class=""><font color="#5856d6" class=""><br class=""></font>Another thing that isn’t clear is what happens when a property with a behavior is set within the initializer of the containing type:<br class=""><font color="#5856d6" class=""><br class=""></font>struct S {<br class="">&nbsp; var [observed] s: String<br class="">&nbsp; init(s: String) {<br class="">&nbsp; &nbsp; // What happens here? &nbsp;Is the behavior’s “set” accessor called? &nbsp;<br class="">&nbsp; &nbsp; // This may not always be desirable, as in the case of “observed"<br class="">&nbsp; &nbsp; self.s = s<br class="">&nbsp; }<br class="">}<br class=""><font color="#5856d6" class=""><br class=""></font>One thought is that it might be good to allow behaviors to have `init` accessor that is used if the property is assigned by an initializer of the containing type (only the first time the property is assigned). &nbsp;This would clarify what happens during initialization of the containing type and allow for different init and set code paths when necessary. &nbsp; It would be distinguished from the behavior initializer by the lack of parens. &nbsp;If that is too subtle we could use a different name for the initialization accessor.<br class=""><font color="#5856d6" class=""><br class=""></font>This would also allow us to support a variant `delayedImmutable` that *must* be assigned during initialization of the containing type, but not necessarily during phase 1. &nbsp;That behavior would facilitate maximum safety when we must pass `self` to the initializer when constructing an instance to assign to a property (not an uncommon use case). &nbsp;<br class=""><font color="#5856d6" class=""><br class=""></font>If the compiler could enforce slightly relaxed initialization rules that require initialization of the property before the initializer exits and before the property is read in the initializer body, but not necessarily during phase 1, then we could achieve nearly complete static safety. &nbsp;The only window for error would be any uses of self that happen outside the initializer body before the property is initialized. &nbsp;<br class=""><font color="#5856d6" class=""><br class=""></font>The behavior might look like this:<br class=""><font color="#5856d6" class=""><br class=""></font>public var behavior phase2Immutable&lt;Value&gt;: Value {<br class="">&nbsp; private var value: Value? = nil<br class=""><font color="#5856d6" class=""><br class=""></font>&nbsp; get {<br class="">&nbsp; &nbsp; guard let value = value else {<br class="">&nbsp; &nbsp; &nbsp; fatalError("property accessed before being initialized")<br class="">&nbsp; &nbsp; }<br class="">&nbsp; &nbsp; return value<br class="">&nbsp; }<br class="">&nbsp;&nbsp;<br class="">&nbsp; init {<br class="">&nbsp; &nbsp; value = initialValue<br class="">&nbsp; }<br class="">}<br class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div></div>This would be a significant improvement over&nbsp;delayedImmutable in many use cases IMO.</div></div></body></html>