<div dir="ltr">+1 for being explicit given there are, at a minimum, costs to size of conforming types.<div><br></div><div>When it comes to visibility to only extensions, that could be more general that just for protocols. That could also be useful for structs and classes.</div><div><br></div><div>For example,</div><div><br></div><div><font face="monospace, monospace">class Foo {</font></div><div><font face="monospace, monospace"> /// Extensions should log all commands</font></div><div><font face="monospace, monospace"> // Treated like private everywhere but extensions.</font></div><div><font face="monospace, monospace"> // It would be an exported symbol but with qualifiers restricting usage</font></div><div><font face="monospace, monospace"> private public(extension) func logCommand(message: String) { ... }</font></div><div><font face="monospace, monospace">}</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">// Can be in another file in same or different module</font></div><div><font face="monospace, monospace">extension Foo {</font></div><div><font face="monospace, monospace"> func doStuff() {</font></div><div><font face="monospace, monospace"> logCommand("Doing stuff now")</font></div><div><font face="monospace, monospace"> // ...</font></div><div><font face="monospace, monospace"> }</font></div><div><font face="monospace, monospace">}</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">let f = Foo()</font></div><div><font face="monospace, monospace">f.logCommand("blah") // error anywhere but same file</font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 11, 2016 at 8:27 PM, Matthew Johnson <span dir="ltr"><<a href="mailto:matthew@anandabits.com" target="_blank">matthew@anandabits.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On Jan 11, 2016, at 7:25 PM, Chris Lattner via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
><br>
><br>
>> On Jan 11, 2016, at 3:46 PM, Trent Nadeau <<a href="mailto:tanadeau@gmail.com">tanadeau@gmail.com</a>> wrote:<br>
>><br>
>> Syntactically, would PwS be special like class-only protocols are now or would it be automatic by having stored property declarations within the protocol?<br>
><br>
> Up for debate. An automatic approach brings hesitation to me, because I don’t want it to be the difference between:<br>
><br>
> protocol P {<br>
> var x : Int { get }<br>
> }<br>
><br>
> and:<br>
><br>
> protocol P {<br>
> var x : Int<br>
> }<br>
><br>
> Did I want a PwS there, or did I just forget {get/set}?<br>
><br>
> Marking the protocol with an attribute or declmodifier would solve that.<br>
<br>
</span>+1. This is something that deserves to be pretty explicit.<br>
<br>
Another point that I think needs to be discussed is whether the protocol storage is just a default that can be overridden or whether it should be protocol-specific. Or should the protocol author be able to choose. For example, can a protocol have private storage that is not visible outside the implementation of default or extension methods? All things that need to be considered IMO.<br>
<br>
Matthew<br>
<br>
><br>
> -Chris<br>
<div class="HOEnZb"><div class="h5">> _______________________________________________<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>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Trent Nadeau</div>
</div>