<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Jordan and I have ben arguing about this over IM a little bit and reached a satisfactory solution. Additionally, turns out we are already doing this (I am not sure if the uniqueness check aspect was thought about).<div class=""><br class=""></div><div class="">Anyways, I am just going to close the discussion.</div><div class=""><br class=""></div><div class="">Michael</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 2, 2016, at 1:09 PM, Michael Gottesman <<a href="mailto:mgottesman@apple.com" class="">mgottesman@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><br class="Apple-interchange-newline">On Feb 2, 2016, at 1:03 PM, Michael Gottesman via swift-dev <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><b class="">Background</b></div><div class=""><b class="">==========</b></div><div class=""><br class=""></div>I have recently been thinking about clang attributes and how we can take advantage of the work other people have done in terms of putting attributes in their headers especially in terms of ARC.<div class=""><br class=""></div><div class="">The two most pervasive such attributes are the const/pure attributes. Trivially the const attribute (since it can not read global memory) can not read or write reference counts. But what about pure? For those who are unfamiliar pure in "c" means that a function's value is only dependent on its arguments and reading global memory. Being able to only read global memory is an interesting property from the ARC perspective since there is only one ARC function that reads a reference count that is exported from the runtime, the uniqueness check. All other ways to read/write a reference count are either restricted to pure swift code or if they are allowed in C++ code write to reference counts. If we were able to say that it is undefined behavior to invoke isUniquelyReferenced from non-swift runtime functions, we immediately could get nice speed boosts when using imported c code that is pure without any further work on the maintainers part.</div><div class=""><br class=""></div><div class=""><b class="">Proposal</b></div><div class=""><b class="">=======</b></div><div class=""><b class=""><br class=""></b></div><div class="">State that is is undefined behavior to reference isUniquelyReferenced in a non-swift function in 3rd party libraries.</div></div></div></blockquote><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">*NOTE* I am talking about the "c" attribute for pure, not the "swift" attribute (whatever that ends up being eventually).</div><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><br class=""></div><div class="">Thoughts?</div><div class="">Michael</div></div>_______________________________________________<br class="">swift-dev mailing list<br class=""><a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-dev" class="">https://lists.swift.org/mailman/listinfo/swift-dev</a></div></blockquote></div></blockquote></div><br class=""></div></body></html>