[swift-evolution] [Pitch] Expose assert configuration functions in standard library

Erica Sadun erica at ericasadun.com
Wed Jun 1 10:45:13 CDT 2016

> On Jun 1, 2016, at 9:15 AM, Erica Sadun <erica at ericasadun.com> wrote:
> Or, to be honest:
> /// Offers user-facing public assert configuration test
> @_transparent
> public
> func isDebugAssertConfiguration() -> Bool {
>   return _isDebugAssertConfiguration()
> }
> which covers, I believe, about 98% of the demand for this feature
> -- E

Following up to myself, now that I'm actually using this, I realize that avoiding using a build configuration test might not be the best idea from the developer experience side of things: 

main.swift:7:9: warning: will never be executed
        print("Not debug assert configuration")
main.swift:4:8: note: condition always evaluates to true
    if isDebugAssertConfiguration() {
Testing debug assertion

Whereas going with if #if debugassert() would simply make code "disappear".

-- E

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

More information about the swift-evolution mailing list