[swift-evolution] [draft] Target environment platform condition

Graydon Hoare ghoare at apple.com
Wed Oct 25 01:06:45 CDT 2017


The arguments to platform conditions aren't keywords; it's true that they're unquoted identifiers but they're treated more like contextual keywords or predefined constants: they're only defined in the argument positions of the conditions they're associated with.

Fwiw, Haiku is already in the list of accepted identifiers for the os() condition (proposal updated to reflect this):

https://github.com/apple/swift/blob/master/lib/Basic/LangOptions.cpp#L28 <https://github.com/apple/swift/blob/master/lib/Basic/LangOptions.cpp#L28>

-Graydon

> On Oct 24, 2017, at 8:49 PM, David Sweeris <davesweeris at mac.com> wrote:
> 
> One quick question... WRT `os()`, should that take a string instead of some keywordish thing? There's at least one OS which has a Swift port, but doesn't show up on that list (Haiku: https://www.haiku-os.org/blog/return0e/2017-08-28_gsoc_2017_porting_swift_to_haiku_-_final_report/ <https://www.haiku-os.org/blog/return0e/2017-08-28_gsoc_2017_porting_swift_to_haiku_-_final_report/>)
> 
> - Dave Sweeris
> 
>> On Oct 24, 2017, at 8:05 PM, Graydon Hoare via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>> Hi,
>> 
>> I'd like to propose a variant of a very minor, additive proposal Erica Sadun posted last year, that cleans up a slightly messy idiomatic use of conditional compilation in libraries. The effects should be quite limited; I'd call it a "standard library" addition except that the repertoire of compiler-control statements isn't strictly part of the stdlib.
>> 
>> Proposal is here: https://gist.github.com/graydon/809af2c726cb1a27af64435e47ef4e5d <https://gist.github.com/graydon/809af2c726cb1a27af64435e47ef4e5d>
>> 
>> Implementation (minus fixits) is here: https://github.com/graydon/swift/commit/16493703ea297a1992ccd0fc4d2bcac7d078c982 <https://github.com/graydon/swift/commit/16493703ea297a1992ccd0fc4d2bcac7d078c982>
>> 
>> Feedback appreciated,
>> 
>> -Graydon
>> 
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-evolution
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171024/fb5ab1ac/attachment.html>


More information about the swift-evolution mailing list