[swift-evolution] [Review] SE-0109: Remove the Boolean protocol

Taras Zakharko taras.zakharko at uzh.ch
Wed Jun 29 10:04:53 CDT 2016


> On 29 Jun 2016, at 15:47, Matthew Johnson via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
> IIRC Optional conformed to this protocol early on and that conformance was removed.  In practice the idea of a protocol for "truthiness" to which non-Boolean types conform caused more confusion than it provided value.  It was a cool idea that just didn't work out so well.
> 
> IMO if it doesn't make sense for Optional to conform it is pretty unlikely it would make sense for other types to conform.  It seems like a good idea to remove the protocol.

I certainly agree that it doesn’t make much sense for Optional, but I believe that implicit bool conformance can be a desirable feature for a number of applications. For instance, imagine a logical inference library where you can have entities like Term or Formula. For those, Boolean conformance would make a lot of sense. Of course, one can also make explicit conversions e.g.:

extension Bool {
 init(x: Term) { self = x.truthValue }
}

if Bool(f1) { … }

But since Bool is a syntactically privileged construct in the language, it makes sense to have it as a target of built-in type conversion support, for the same reason why we have CustomStringConvertible etc. 

To be honest, I’d prefer to have a generic mechanism such as:

ImplicitConvertible<T> {
	var as -> T { get }
} 

to replace the Custom*Convertible and friends, but thats a different topic. 

— Taras

> 
>> 
>> - Dave Sweeris
>> 
>> 
>> On Jun 29, 2016, at 01:44, Douglas Gregor via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>>> Hello Swift community,
>>> 
>>> The review of SE-0109 "Remove the Boolean protocol" begins now and runs through July 4, 2016. The proposal is available here:
>>> 
>>> https://github.com/apple/swift-evolution/blob/master/proposals/0109-remove-boolean.md <https://github.com/apple/swift-evolution/blob/master/proposals/0109-remove-boolean.md>
>>> Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at
>>> 
>>> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
>>> or, if you would like to keep your feedback private, directly to the review manager. When replying, please try to keep the proposal link at the top of the message:
>>> 
>>> Proposal link:
>>> 
>>> https://github.com/apple/swift-evolution/blob/master/proposals/0109-remove-boolean.md <https://github.com/apple/swift-evolution/blob/master/proposals/0109-remove-boolean.md>
>>> Reply text
>>> 
>>> Other replies
>>>  <https://github.com/apple/swift-evolution#what-goes-into-a-review-1>What goes into a review?
>>> 
>>> The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:
>>> 
>>> What is your evaluation of the proposal?
>>> Is the problem being addressed significant enough to warrant a change to Swift?
>>> Does this proposal fit well with the feel and direction of Swift?
>>> If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
>>> How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
>>> More information about the Swift evolution process is available at
>>> 
>>> https://github.com/apple/swift-evolution/blob/master/process.md <https://github.com/apple/swift-evolution/blob/master/process.md>
>>> Thank you,
>>> 
>>> -Doug
>>> 
>>> Review Manager
>>> 
>>> _______________________________________________
>>> swift-evolution mailing list
>>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>>> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

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


More information about the swift-evolution mailing list