[swift-evolution] [Pitch] #warning

Erica Sadun erica at ericasadun.com
Sun May 29 14:58:56 CDT 2016


> On May 29, 2016, at 1:44 PM, Chris Lattner via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> On May 28, 2016, at 8:26 PM, Jon Shier via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> 	I appreciate the sentiment, but I think we should reserve warnings for actual compiler diagnostics.
> 
> +1.  The IDE should just pick up "// FIXME: “ comments and summarize them as issues.  Xcode already shows them in its jump bar.
> 
> That said, I can see a use for #error, as Charlie shows downthread:
> 
> #if os(OSX)
> 	/// ...
> #if os(Linux)
> 	/// ...
> #else
> 	#error("This OS isn't supported yet.").
> #endif
> 
> -Chris

One could make a weak argument that #warning/#error/#message make a nice family of flexible alerts
just because they're kind of what we're used to already. A possible use case for warning:

#if canImport(Cocoa)
    #warning("Your UI will look bad. This code works under OS X but this library is intended for iOS-like environments")
#elseif !canImport(UIKit)
    #error("Unsupported target GUI")
#endif

-- E

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


More information about the swift-evolution mailing list