<div dir="ltr"><div style="font-size:13px">I like Shawn's proposal:</div><div style="font-size:13px"><br></div><div style="font-size:13px"><font face="monospace, monospace">var foo: Int { private(file) set }</font></div><div style="font-size:13px"><font face="monospace, monospace"><br></font></div><div style="font-size:13px"><font face="arial, helvetica, sans-serif">In fact it's probably more sensible than the current private(set) IMO.</font></div><div style="font-size:13px"><font face="monospace, monospace"><br></font></div><div style="font-size:13px"><br></div><div style="font-size:13px">While I like <font face="monospace, monospace">private(get: file, set: module)</font> idea, I think it just gets too inconsistent with <span style="font-family:monospace,monospace">private(set: public)</span><font face="arial, helvetica, sans-serif"> and</font><span style="font-family:monospace,monospace"> </span><span style="font-family:monospace,monospace">private(set: private)</span><font face="arial, helvetica, sans-serif"> (?!)</font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 15, 2016 at 3:39 PM, Jonathan Hull via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span class=""><pre style="white-space:pre-wrap;background-color:rgb(255,255,255)"><i>On Mar 14, 2016, at 8:36 PM, Patrick Pijnappel via swift-evolution <<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">swift-evolution at swift.org</a>> wrote:</i></pre></span><blockquote type="cite"><pre style="white-space:pre-wrap;background-color:rgb(255,255,255)">The only question is (as Sean mentioned) how this combines with the syntax
for setter access level, e.g. the current private(set). Options:
- Unnamed 2nd argument, giving private(file), private(file, set),
private(set).
- Named 2nd argument, giving e.g. private(file), private(file, accessor:
set), private(accessor: set). Less ambiguity but longer.
- Not using multiple arguments, but that'd probably break consistency with
the other unification efforts going on to make everything look like
function calls.</pre></blockquote><div>What about the following 3 forms?</div><div><br></div><div>private(file) //both setter and getter have file scope</div><div>private(set: file) //setter has file scope. Equivalent to current “private(set)"</div><div>private(get: module, set: file) //getter has module scope & setter has file scope</div><div><br></div><div>It is a bit weird, but we should probably also allow “public" in that last form: private(get: public, set: module)</div><div><br></div><div>Thanks,</div><div>Jon</div></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>