<div dir="ltr">Storage properties on protocol or in extension plus something when call maybe a solution:<div><br></div><div><div> protocol Marriageable {</div><div> var foo:Int = 0; // actual a var.</div><div> var ring: String? // actual a var.</div><div> }</div><div> protocol CallReceivable {</div><div> var ring: String? // actual a var.</div><div> }</div><div><br></div><div> struct Person: Marriageable, CallReceivable { }</div></div><div><br></div><div>OR</div><div><span style="font-size:13px;line-height:19.5px"> protocol Marriageable {</span><br style="font-size:13px;line-height:19.5px"><span style="font-size:13px;line-height:19.5px"> var ring: String? { get set } </span><br style="font-size:13px;line-height:19.5px"><span style="font-size:13px;line-height:19.5px"> }</span><br style="font-size:13px;line-height:19.5px"><span style="font-size:13px;line-height:19.5px"> protocol CallReceivable {</span><br style="font-size:13px;line-height:19.5px"><span style="font-size:13px;line-height:19.5px"> var ring: String? { get set } </span><br style="font-size:13px;line-height:19.5px"><span style="font-size:13px;line-height:19.5px"> }</span><br style="font-size:13px;line-height:19.5px"><br style="font-size:13px;line-height:19.5px"><span style="font-size:13px;line-height:19.5px"> struct Person {</span><span style="font-size:13px;line-height:19.5px"> }</span><br></div><div> </div><div> extension <span style="font-size:13px;line-height:19.5px">Person:</span> <span style="font-size:13px;line-height:19.5px">Marriageable{</span></div><div><span style="font-size:13px;line-height:19.5px"> </span><span style="font-size:13px;line-height:19.5px">var ring: String?</span></div><div><span style="font-size:13px;line-height:19.5px"> }</span></div><div><span style="font-size:13px;line-height:19.5px"><br></span></div><div><div> extension <span style="font-size:13px;line-height:19.5px">Person:</span> <span style="font-size:13px;line-height:19.5px">CallReceivable</span><span style="font-size:13px;line-height:19.5px">{</span></div><div><span style="font-size:13px;line-height:19.5px"> </span><span style="font-size:13px;line-height:19.5px">var ring: String?</span></div><div><span style="font-size:13px;line-height:19.5px"> }</span></div></div><div dir="ltr"><div><br></div><div>So:</div><div><br></div><div>var person = Person()</div><div>person.foo = 1 // ok<br></div><div><br></div><div>person.ring = getRingtone() // error, ring is ambiguous</div><div>(person as CallReceivable).ring = getRingtone() // ok</div><div>OR</div><div>person.CallReceivable.ring = getRingtone() // ok | CallReceivable is a know person protocol, so can get a implicity dot notation, like .dynamicType.staticMethod();</div><div><br></div><div>Anyway, it's not an easy problem to solve.<br></div><div><br><div class="gmail_quote"><div dir="ltr">Em sáb, 9 de jan de 2016 às 01:09, Brent Royal-Gordon via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> I don’t really get what you are driving at.<br>
<br>
The point is that, although `A` and `B` both require properties with the same name, they expect different semantics from that property. Let's maybe give these more concrete names so you can understand the idea:<br>
<br>
protocol Marriageable {<br>
var ring: String? { get set } // File name of image of this person's wedding ring.<br>
}<br>
protocol CallReceivable {<br>
var ring: String? { get set } // File name of ringtone to be used for this person.<br>
}<br>
<br>
struct Person: Marriageable, CallReceivable {<br>
var ring: String?<br>
}<br>
<br>
Of course a person is marriageable and can this have "a ring", and of course you can also receive a call from them and they can thus have "a ring". But in reality, the "ring" that satisfies one of these things will not work for the other. If your best friend gets married and you add an image of the ring, then the next time your friend calls you, the phone ringing screen will try to play a JPEG as an MP3.<br>
<br>
The "ring" example is, of course, slightly contrived, but I'm sure you can imagine a similar problem with real names, where you end up using the same term for two different and incompatible things.<br>
<br>
What the OP is basically asking is, when Swift sees the same type conforming to Marriageable and CallReceivable, should it optimistically assume that the `ring` properties they both require are compatible and allow the code to pass through without comment? Or should it pessimistically assume that the `ring` properties are incompatible and emit a warning or error about them?<br>
<br>
--<br>
Brent Royal-Gordon<br>
Architechies<br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">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>
</blockquote></div></div></div></div>