<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""><blockquote type="cite" class=""><pre style="white-space: pre-wrap; background-color: rgb(255, 255, 255);" class="">If your code has many manual type erasing wrappers corresponding to
protocols with associated types and/or Self requirements that also never
have to trap type mismatches, that would certainly be instructive
empirical data. Would you care to share the protocols and wrappers you
are talking about?</pre></blockquote><div class="">This code is a bit embarrassing (I wrote most of it as I was still learning Swift), but if it is helpful I will share:</div></div><div class=""><a href="https://gist.github.com/jonhull/639e756ad5228348f93f40f06169588c" class="">https://gist.github.com/jonhull/639e756ad5228348f93f40f06169588c</a></div><div class=""><br class=""></div><div class="">It doesn’t trap anywhere (that I know about). Some of the code which calls it does throw an error in the case of mismatched types (but it doesn’t/shouldn't crash). Most functions which use it are generic on the associatedType.</div><div class=""><br class=""></div><div class="">It does work fairly well though (even on the AppleWatch). The main issue is that I have no way to persist the values which have been drawn into the type-erased world (or even the value-type world, really).</div><div class=""><br class=""></div><div class="">Also, if anyone has a better way to write the type erasing wrapper, I would love to hear it. These are very memory intensive…</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Jon</div></body></html>