<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class="">I often find myself running up against errors like "Inheritance from non-protocol, non-class type”.</span><div class=""><span class=""><br class=""></span></div><div class=""><span class="">Here’s a contrived example.<br class=""></span><span class=""><span class=""><br class=""></span></span><span class=""><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);" class=""><span style="color: rgb(222, 56, 165);" class="">public</span> <span style="color: rgb(222, 56, 165);" class="">protocol</span> NoiseMechanism : <span style="color: rgb(0, 177, 255);" class="">class {</span></div></span><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);" class=""><span style="color: #00b1ff" class=""> </span> <span style="color: #de38a5" class="">func</span> makeNoise()</div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);" class="">}</div><div style="margin: 0px; line-height: normal; background-color: rgb(0, 0, 0); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(222, 56, 165); background-color: rgb(0, 0, 0);" class="">public<span style="color: #ffffff" class=""> </span>protocol<span style="color: #ffffff" class=""> Animal {</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);" class=""> <span style="color: #de38a5" class="">associatedtype</span> NoiseMaker: <span style="color: #08fa95" class="">NoiseMechanism</span></div><p style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(0, 0, 0); min-height: 16px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);" class=""> <span style="color: #de38a5" class="">static</span> <span style="color: #de38a5" class="">var</span> numberOfLegs: <span style="color: #00b1ff" class="">Int</span> { <span style="color: #de38a5" class="">get</span> }</div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);" class="">}</div><div style="margin: 0px; line-height: normal; background-color: rgb(0, 0, 0); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);" class=""><span style="color: #de38a5" class="">open</span> <span style="color: #de38a5" class="">class</span> <span style="text-decoration: underline" class="">A</span>nimalWrapper<A: <span style="color: #08fa95" class="">Animal</span>> : <span style="color: #08fa95" class="">A</span>.<span style="color: #00b1ff" class="">NoiseMaker</span> {</div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);" class="">}</div></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);" class=""><br class=""></div><span class=""><br class=""></span><span class="">The benefit is that a consuming developer can inject types using one parameter and result in a robust type ecosystem.</span><div class=""><br class=""></div><div class="">This ties into my previous request to have non-class constraints (enums, structs) on protocols and in where clauses. I’m very interested in using protocols to enforce architectural decisions.</div><div class=""><br class=""></div><div class="">What do people generally think about this? Is a protocol the right construct? Is this something that could be possible in the future, or completely off the table due to complexity, or just not addressed due to low priority?</div></body></html>