Re: Trouble with imported enums in Swift
Re: Trouble with imported enums in Swift
- Subject: Re: Trouble with imported enums in Swift
- From: Quincey Morris <email@hidden>
- Date: Tue, 21 Oct 2014 23:53:05 +0000
On Oct 21, 2014, at 16:25 , Rick Mann <email@hidden> wrote:
>
> But the names of the elements all have to start with the type name, and that means not only changing the entire code base that uses the header, but also changing the naming convention used by that code base. Sure, we can do it, but it'll irritate a number of engineers, at best.
It’s a time-honored (ahem!) tradition in C and C++ to use macros to smooth over the differences when writing code that crosses platform and architecture boundaries. It’s a time-honored (ugh!) tradition that such code tends to refuse to acknowledge that Mac platforms exist.
Why is the Mac automatically the poor cousin? Since, you say, this code base is in-house, you have the opportunity to treat the Mac requirements equally, which means those other platforms might have to suck up their compatibility macros, and like it.
Or, if you don’t have that kind of influence over the code base, you, Rick, are going to have to re-write your enums in Swift, and like it.
> All because Swift bridging wasn't designed to be more accommodating.
Swift doesn’t seem to be designed to be accommodating towards C or C++. It seems to be designed to be accommodating towards code already written for Cocoa frameworks. That means it understands Obj-C syntax, which means it understands C syntax automatically (though not non-C C++ syntax), but it doesn’t “translate” Obj-C programs, only Obj-C *headers*, and only the parts it want to translate**.
Again, it’s not the cross-compiler you want it to be. If you don’t like that, you get to file a Radar like everyone else.
> The reason this header is shared in the first place is that the values are used in a protocol between nodes.
It’s not really sharing if the Mac version isn’t allowed to impose any requirements on your code base. See above, under “poor cousin”.
** It only translates a small subset of macros, too.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden