<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><blockquote type="cite" class="clean_bq" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span><div><div>Does it make sense to somehow unify them? Perhaps turn Bool into a typealias for Optional<Void> and move all of its conformances into (not yet supported) conditional conformances on Optional?</div></div></span></blockquote></div><p>I’m against unifying those concepts, for two main reasons:</p><p>1) These are two separate constructs. When Bool is turned into Optional<Void>, it’s logical to be able to map it to Optional<T>, to flatMap it, to forEach it etc. I can’t see a situation where mapping Bool to, let’s say, Optional<Array<String>> is a readable statement.</p><p>2) Bool is a very basic type, one of the first to use when learning programming. Making it an alias for a widely more complicated construct will introduce special cases that will be misleading for those learning to code.</p><p><br></p><p>I believe the situation where Optional<Void> is used to indicate the existence or absence of particular condition could be better resolved. Two alternatives that come to mind:</p><p>a) „isDefined” method on Optional, converting any Optional to Bool</p><p>b) just writing optionalVoid.map { return true } ?? false at the end of your pipe to transform otherwise ambiguous Void? to Bool clearly expressing your thoughts.</p><p><br></p><p>Krzysztof</p><p><br></p><div><blockquote type="cite" class="clean_bq" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span><div><div><br><br>--<span class="Apple-converted-space"> </span><br>Brent Royal-Gordon<br>Architechies<br><br>_______________________________________________<br>swift-evolution mailing list<br>swift-evolution@swift.org<br>https://lists.swift.org/mailman/listinfo/swift-evolution<br></div></div></span></blockquote></div></body></html>