[swift-evolution] Bool vs. Optional<Void>

Jordan Rose jordan_rose at apple.com
Fri Dec 18 11:17:35 CST 2015


This idea has actually come up before, but ultimately we came to the same conclusion as most people here: just because they're isomorphic and fairly similar doesn't mean they're really the same type. (For example, we have some auto-corrections if you try to use an Optional as a Bool. But if your Optional is coincidentally Optional<Void>, suddenly your code is valid! This can happen with optional chaining.)

> On Dec 17, 2015, at 11:01 , Pyry Jahkola via swift-evolution <swift-evolution at swift.org> wrote:
> 
> (Possibly related to this is that Bool is a struct and not an enum in Swift.)

We've tossed around the idea of going to an enum now that we actually have efficient enum-handling instructions in SIL. I think there's still a bit of work to be done there, though.

Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151218/522daf45/attachment.html>


More information about the swift-evolution mailing list