<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="">Hi Drew,<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 5, 2016, at 12:08 AM, Drew Crawford <<a href="mailto:drew@sealedabstract.com" class="">drew@sealedabstract.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 4, 2016, at 3:09 PM, Tony Parker <<a href="mailto:anthony.parker@apple.com" class="">anthony.parker@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: HelveticaNeue; 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; float: none; display: inline !important;" class="">In this particular case, how would you use the #if? Any should be source compatible with AnyObject, since Any is a superset of AnyObject, right?</span></div></blockquote></div><br class=""><div class="">Well I don't know what you mean by "compatible" but the thing about strongly typed languages is we can't do</div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><br class=""></div><div class="">let a: Any</div><div class=""><br class=""></div><div class="">foo(a: AnyObject) { /* */ }</div><div class=""><br class=""></div><div class="">foo(a)</div></blockquote><br class=""><div class="">because that is "type error". We can of course cast, but if in Darwin a.self is already AnyObject, casting again to AnyObject produces a warning, and I try to not have any warnings in my code.</div><div class=""><br class=""></div><div class="">This is kind of a side quest–there are a lot of ways to work around these problems–but the obviously straightforward one was to use #if to conditionally cast, and that wasn't available.</div><div class=""><br class=""></div><div class="">More broadly I find myself using the #if that I've created very often–my workflow seems to be to create an extension on an NSClass in-file that adds missing functionality and then PR it to corelibs-foundation afterwards–and conditional compilation really helps with that workflow.</div></div></div></blockquote></div><br class=""></div><div class="">My main objection is that I don’t want us to require clients to #if at all, in the long term. Putting it in now means that it will be easier to say “just #if” instead of fixing the underlying source incompatibility problem.</div><div class=""><br class=""></div><div class="">I think that if we get to a time nearer to the finish line of Swift 3 and we still have many source incompatible changes between the Core Libs Foundation and a corresponding Darwin Foundation then we should introduce something like the #if.</div><div class=""><br class=""></div><div class="">- Tony</div><div class=""><br class=""></div></body></html>