<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Mar 28, 2018, at 3:07 PM, John McCall <<a href="mailto:rjmccall@apple.com" class="">rjmccall@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">I think we actually take the parameter as a pr-value, which in some ways is better because it means that you can pass something either by copy or by move. I don't know if we then try to move-assign the ivar from the parameter, but we certainly<span class="Apple-converted-space"> </span><i class="">should</i>.</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">I think the more interesting question is the type of the getter. The getter really can't return a && or pr-value. Do we recognize that a type is move-only and just make the getter return a `const &`? Does that mean we forbid synthesizing such a property as atomic?</div></div></blockquote></div><br class=""><div class=""><br class=""></div><div class="">Let me focus on issues I encounter that make @property problematic or inconvenient. perhaps I'm misusing the tool.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">consider the code below. What I want to be able to do is get a reference to the map instance variable and modify it. but the code doesn't compile because the property wants to return a copy. </div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175); background-color: rgb(255, 255, 255);" class=""><span style="color: rgb(4, 51, 255);" class="">@interface</span><span style="color: rgb(0, 0, 0);" class=""> </span>AppDelegate<span style="color: rgb(0, 0, 0);" class=""> ()</span></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(4, 51, 255); background-color: rgb(255, 255, 255);" class="">@property<span style="color: rgb(0, 0, 0);" class=""> (</span>nonatomic<span style="color: rgb(0, 0, 0);" class="">, </span>assign<span style="color: rgb(0, 0, 0);" class="">) </span><span style="color: rgb(52, 149, 175);" class="">std</span><span style="color: rgb(0, 0, 0);" class="">::</span><span style="color: rgb(52, 149, 175);" class="">map</span><span style="color: rgb(0, 0, 0);" class=""><</span><span style="color: rgb(52, 149, 175);" class="">std</span><span style="color: rgb(0, 0, 0);" class="">::</span><span style="color: rgb(52, 149, 175);" class="">string</span><span style="color: rgb(0, 0, 0);" class="">, </span>int<span style="color: rgb(0, 0, 0);" class="">> prop;</span></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(4, 51, 255); background-color: rgb(255, 255, 255);" class="">@end</div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(4, 51, 255); background-color: rgb(255, 255, 255);" class="">@implementation<span style="color: rgb(0, 0, 0);" class=""> AppDelegate</span></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(4, 51, 255); background-color: rgb(255, 255, 255);" class="">@synthesize<span style="color: rgb(0, 0, 0);" class=""> prop;</span></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">- (<span style="color: rgb(4, 51, 255);" class="">void</span>)applicationDidFinishLaunching:(<span style="color: rgb(52, 149, 175);" class="">NSNotification</span> *)aNotification</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">{</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgb(4, 51, 255);" class="">auto</span>& <span style="text-decoration: underline;" class="">t</span>mpP = <span style="text-decoration: underline; color: rgb(4, 51, 255);" class="">self</span><span style="text-decoration: underline;" class="">.</span>prop;</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 16px;" class=""> tmpP[<span style="color: rgb(180, 38, 26);" class="">"test"</span>] = 1;</div></div><div class="">}</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(4, 51, 255); background-color: rgb(255, 255, 255);" class="">@end</div></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">ok. so I try this... </div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(4, 51, 255); background-color: rgb(255, 255, 255);" class="">@property<span style="color: #000000" class=""> (</span>nonatomic<span style="color: #000000" class="">, </span>assign<span style="color: #000000" class="">) </span><span style="color: #3495af" class="">std</span><span style="color: #000000" class="">::</span><span style="color: #3495af" class="">map</span><span style="color: #000000" class=""><</span><span style="color: #3495af" class="">std</span><span style="color: #000000" class="">::</span><span style="color: #3495af" class="">string</span><span style="color: #000000" class="">, </span>int<span style="color: #000000" class="">>& prop;</span></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">but then I encounter the following that doesn't work...</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #0433ff" class="">self</span>.prop = std::map<std::string, <span style="color: #0433ff" class="">int</span>>{{<span style="color: #b4261a" class="">"test"</span>,1}, {<span style="color: #b4261a" class="">"test2"</span>,2}};</div></div><div class=""><br class=""></div><div class="">and of course this doesn't compile...</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(4, 51, 255); background-color: rgb(255, 255, 255);" class="">@property<span style="color: #000000" class=""> (</span>nonatomic<span style="color: #000000" class="">, </span>assign<span style="color: #000000" class="">) </span><span style="color: #3495af" class="">std</span><span style="color: #000000" class="">::</span><span style="color: #3495af" class="">map</span><span style="color: #000000" class=""><</span><span style="color: #3495af" class="">std</span><span style="color: #000000" class="">::</span><span style="color: #3495af" class="">string</span><span style="color: #000000" class="">, </span>int<span style="color: #000000" class="">>&& prop;</span></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">The only answer I see here is to manually write the accessor functions and have an explicit instance variable declaration. I'd like to be able to use @property for convenience, but I see no way to make it work for what I naturally want. is there an answer that isn't "don't use @property"?</div><div class=""><br class=""></div><div class="">-James</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175); background-color: rgb(255, 255, 255);" class=""><br class=""></div></div></body></html>