<div dir="ltr">Thanks all! It's great to hear that this wouldn't be completely unwelcome -- especially Swift Darwin with Objective-C interop disabled.<div><br></div><div>I'll try and send a patch sometime soon -- although I'm busy with work stuff, so at the latest it'll be sometime in December... in the meantime, I created a task for it: <a href="https://bugs.swift.org/browse/SR-3292">https://bugs.swift.org/browse/SR-3292</a>. Feel free to comment there, or to claim the task for yourself. :)<div><br></div><div>- Brian Gesiak</div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 28, 2016 at 5:02 PM, John McCall <span dir="ltr"><<a href="mailto:rjmccall@apple.com" target="_blank">rjmccall@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> On Nov 28, 2016, at 1:33 PM, Joe Groff via swift-dev <<a href="mailto:swift-dev@swift.org">swift-dev@swift.org</a>> wrote:<br>
>> On Nov 28, 2016, at 7:26 AM, Brian Gesiak via swift-dev <<a href="mailto:swift-dev@swift.org">swift-dev@swift.org</a>> wrote:<br>
>><br>
>> Hello all!<br>
>><br>
>> While reviewing <a href="https://github.com/apple/swift/pull/5904" rel="noreferrer" target="_blank">https://github.com/apple/<wbr>swift/pull/5904</a>, I had a crazy thought, and I'd like to get some feedback on it.<br>
>><br>
>> Here's my original comment <<a href="https://github.com/apple/swift/pull/5904#discussion_r89797900" rel="noreferrer" target="_blank">https://github.com/apple/<wbr>swift/pull/5904#discussion_<wbr>r89797900</a>>.<br>
>><br>
>> Basically, I notice that we have two sets of targets we compile the Swift runtime and standard library for:<br>
>><br>
>> 1. 'ALL_APPLE_PLATFORMS', which is composed of macOS, iOS, tvOS, and watchOS.<br>
>> 2. The other platforms: Linux, FreeBSD, Android, Cygwin, and (as of the pull request above) Windows.<br>
>><br>
>> In other words:<br>
>><br>
>> 1. All the platforms that support Objective-C interop. I suggest we call these 'OBJC_INTEROP_PLATFORMS' in CMake.<br>
>> 2. All the platforms that don't. I suggest we call these 'NO_OBJC_INTEROP_PLATFORMS' in CMake.<br>
>><br>
>> ---<br>
>><br>
>> I think the above is a good idea, regardless of how you feel about my other, zanier thought:<br>
>><br>
>> Over the weekend I learned of the mulle-objc project <<a href="https://mulle-objc.github.io" rel="noreferrer" target="_blank">https://mulle-objc.github.io</a>><wbr>. It boasts an Objective-C compiler and runtime that works on Linux.<br>
>><br>
>> Now, I don't know if Swift's Objective-C interop will work completely with mulle-objc, but I did a bit of experimenting over the weekend, and it seems possible. But one obstacle is the fact that the Swift build system conflates "an Apple target" with "capable of Objective-C interop." To even start working with mulle-objc, I had to remove a lot of `#ifdef __APPLE__` in the code.<br>
><br>
> It's not only the build system, but the IRGen and runtime implementation of ObjC interop is also heavily biased towards Apple's implementations of the ObjC runtime and Foundation on Darwin. Just changing all those #ifdef __APPLE__ s to #if SWIFT_OBJC_INTEROP is not going to get you very far working with another ObjC implementation. As Doug noted, supporting ObjC-less Darwin would on the other hand be very useful!<br>
<br>
</span>Right. If you really wanted to support using Swift with a different Objective-C ABIs, I think the first step would be to do some work in clang to expose an abstract API for building classes. You'd still need *some* ABI-specific code in Swift IRGen, I expect, but it ought to be possible to re-use the majority of Clang's ObjC targeting code.<br>
<span class="HOEnZb"><font color="#888888"><br>
John.<br>
</font></span></blockquote></div><br></div>