[swift-evolution] Make distinction between ?? -> T and ?? -> T?

Pyry Jahkola pyry.jahkola at iki.fi
Mon Mar 7 19:13:30 CST 2016


> With the left-associative version, we have to do extra tests for nil, but those will be optimized away when ?? is inlined. We also create more closure instances, but again we can probably optimize that away. With the right-associative version, we end up with nested closures instead, which may be harder to optimizeā€¦or may not be.

FWIW, the current implementation is right-associative: https://github.com/apple/swift/blob/12b793c87f160a0f18bb8762e425174205c5d80a/stdlib/public/core/Policy.swift#L399


More information about the swift-evolution mailing list