If it didn’t have it, I am sure that we’d sooner or later get a request for CustomBoolConvertible :) Bool is a magic type which is privileged by the compiler for control-flow constructions. Having a hook into that magic would allow the programmer to more clearly express certain models (there are examples in this thread). Not to mention that we already have a precedent : CustomStringConvertible (I don’t suppose anyone would argue for removing THAT). I agree that conversion to boolean has less utility, but IMO removing a hook into privileged Bool type makes the language more asymmetrical and is not a design choice I would make.
Anyway, I think I’ve made my arguments clear. Sorry for the noise. For a full feedback: What is your evaluation of the proposal? -1. Implicit Bool conversion is a useful utility when modelling logical entities. The confusion between Boolean and Bool can be solved by refactoring Boolean into CustomBoolConvertible Is the problem being addressed significant enough to warrant a change to Swift? Yes (confusion potential), but removing the protocol over renaming it removes useful functionality from the language. Does this proposal fit well with the feel and direction of Swift? IMO, no. So far, general concepts/models are playing a vital role in Swift and are source of its elegance. Boolean might be a ’small’ feature, but its a natural part of the system. If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those? Most modern scripting languages offer a boolean conversion hook. Its a useful thing to have. How much effort did you put into your review? A glance, a quick reading, or an in-depth study? A glance. > On 29 Jun 2016, at 21:37, Chris Lattner <[email protected]> wrote: > > >> On Jun 29, 2016, at 5:48 AM, Taras Zakharko via swift-evolution >> <[email protected]> wrote: >> >> Just a quick clarification: I was under impression that the utility of >> Boolean was that one could extend any type to behave as a boolean type and >> thus be used in control flow constructions etc. Not something that has to do >> often, but nice to have nevertheless. > > The baseline is not generally whether something that is “nice to have > nevertheless”. A better way to look at legacy features like this is: if > Swift 3 didn’t already have this feature, would we add it now? > > -Chris >
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
