<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=""><div class="">Now I understand your concerns. But you misunderstood my proposal. I'll restate my points about “type properties”:</div><div class=""><br class=""></div><div class="">1. Stored class properties(let’s call them “class instance variables” for better discussion about “stored type properties” below) are not very useful or needed. So we are not likely to add them to Swift. This one we both agree. So there is only one kind of stored properties for types and they are stored like global variables, which are now called “static stored properties“. </div><div class=""><br class=""></div><div class="">2. `type` properties in my proposal covers both stored properties and calculated properties. Except for the `type` keyword, the way they are declared are exactly the same as that of instance properties:</div><div class="">```</div><div class="">class Foo {</div><div class=""> type let i = 1 // stored type property</div><div class=""> type var k: Int { // calculated type property</div><div class=""> return 1</div><div class=""> }</div><div class="">} </div><div class="">```</div><div class=""><br class=""></div><div class="">3. Since we’ve already excluded “class instance variables” in point 1, stored type properies in my proposal are certainly not “class instance variables”. They behave the same as the current “static stored properties”. This is where you misunderstood me. </div><div class=""><br class=""></div><div class="">So you don’t need the `final` keyword to make them “static”. If they are “stored”(VS calculated) they are “static”. We just don’t use `static` as the keyword.</div><div class=""><br class=""></div><div class="">Static storage is the implementation details. Just like global variable declarations don’t need `static` keyword though they use static storage, stored type property declarations don’t need `static` keyword to denote they use static storage. After all there is only one kind of stored type properties.</div><div class=""><br class=""></div><div class="">As you said most people expect type properties to be “static”, together with the fact that most people don’t know about “class instance variables”, stored type properties being “static” is simply the commonly accepted default behavior.</div><div class=""><br class=""></div><div class="">As to those who know about “class instance variables” we need to explain to them that stored type properties are not “class instance variables”. But since we need to tell them that Swift doens’t support “class instance variables” at all in the first place, it is not an extra complication.</div><div class=""><br class=""></div><div class="">Besides, we shouldn’t use `final` to denote storage at all for `final` is about inheritability/overridability not about storage.</div><div class=""><br class=""></div><div class="">Thanks for discussing with me:)</div><div class=""><br class=""></div><div class="">- Ling</div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On Dec 7, 2015, at 7:15 PM, Chris Lattner <<a href="mailto:clattner@apple.com" class="">clattner@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 7, 2015, at 5:09 PM, Ling Wang <<a href="mailto:an00na@gmail.com" class="">an00na@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><div class=""><blockquote type="cite" class=""><br class="Apple-interchange-newline">Class stored properties VS. static stored properties<br class=""></blockquote><br class=""><br class="">You list many complaints about class properties, then go on to suggest that we replace “class” with “type”. It seems that your complaints aren’t actually relevant to the proposal, since you’re not actually removing them from the model. In fact, instead of “static var x” you’d have to write “final type var x”, which would be an unfortunate regression.<br class=""></div></div></blockquote><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">When you said "You list many complaints about class properties” you meant “class stored properties”, right?</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">If so I don’t think I’ve ever complained about it because Swift doesn’t support class stored properties yet. My points about class stored properties are:</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">1. Are they useful enough? Do we want it in Swift?</div></div></div></div></blockquote><blockquote type="cite" class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">2. Are we going to add it in Swift? If yes, when?</div></div></div></div></blockquote><div class=""><div class=""><br class=""></div></div>Perhaps, but they are very low priority. </div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">3. If no, then we only have one kind of type stored properties, why do we need two keywords for them?</div></div></div></div></blockquote><div class=""><br class=""></div><div class="">You’re missing what I’m trying to say. With your design:</div></div><div class=""><br class=""></div><div class="">class Foo {</div><div class=""> type var x : Int</div><div class="">}</div><div class=""><br class=""></div><div class="">This would be a stored class property, which isn’t supported and won’t be for the forseeable. This would require people to write:</div><div class=""><br class=""></div><div class=""><div class="">class Foo {</div><div class=""> final type var x : Int</div><div class="">}</div><div class=""><br class=""></div><div class="">This is a lot worse than:</div><div class=""><br class=""></div><div class=""><div class="">class Foo {</div><div class=""> static var x : Int</div><div class="">}</div></div><div class=""><br class=""></div><div class="">... both in terms of boilerplate noise, but also in that it leads them down the wrong path. Many people would write “type var x : Int” wanting a static member, because they don’t understand how class variables work.</div><div class=""><br class=""></div><div class="">Your approach would make class members *more* prominent, not less. We’ve tried this, this is not a theoretical concern.</div><div class=""><br class=""></div><div class="">-Chris</div></div></div></div></blockquote></div><br class=""></body></html>