Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-9358] Better convention for Apple ObjC systems #51825

Open
milseman mannequin opened this issue Nov 27, 2018 · 4 comments
Open

[SR-9358] Better convention for Apple ObjC systems #51825

milseman mannequin opened this issue Nov 27, 2018 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself standard library Area: Standard library umbrella

Comments

@milseman
Copy link
Mannequin

milseman mannequin commented Nov 27, 2018

Previous ID SR-9358
Radar rdar://problem/52193385
Original Reporter @milseman
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler, Standard Library
Labels Bug
Assignee None
Priority Medium

md5: 252ad8d5a090e03b9a37520a8a22a729

Issue Description:

The standard library and tests uses

#if _runtime(_ObjC)

to check for a platform with ObjC interoperability, which depends on internal conventions used in Apple's implementation of both the runtime and Foundation, as well as perhaps baking in an assumption the system is Darwin. We should come up with a better convention here that's more explicit, perhaps

_runtime(_AppleObjC)
@milseman
Copy link
Mannequin Author

milseman mannequin commented Nov 27, 2018

@swift-ci create

@milseman
Copy link
Mannequin Author

milseman mannequin commented Nov 27, 2018

@davezarzycki
Copy link
Collaborator

With my ex-Apple hat on:

  • I don't think that `_runtime(_AppleObjC)` is appreciably better than `_runtime(ObjC)`. Both are vague. Are they narrowly defined to just the literal ObjC runtime? Or do these conditionals imply Foundation and its dependencies? If it is the latter, then why is the check not spelled that way?

  • In practice, Apple's operating systems are fairly monolithic and pretending otherwise is brittle and pointless most of the time. What people frequently need and want a "is any Apple OS" conditional, especially for logic that is shared across Apple's operating systems (like ObjC and Foundation).

@belkadan
Copy link
Contributor

These queries are underscored for a reason. Having a "meta-OS" query that means "any Apple OS" is a different request than "is ObjC interop enabled", and (as mentioned on the PR), _runtime is about the latter (and can be used to test interop-ish things on non-Apple platforms).

The conditional should not imply the existence of, say, CoreGraphics, but it can imply the existence of Foundation because our ObjC interop story is built on top of Foundation (NSString, NSArray, NSDictionary, NSSet, NSError).

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

2 participants