[swift-evolution] [Pitch] Percentage Type

David Sweeris davesweeris at mac.com
Wed Jan 17 02:04:04 CST 2018

Sent from my iPhone

> On Jan 16, 2018, at 23:45, Jonathan Hull via swift-evolution <swift-evolution at swift.org> wrote:
> Mainly semantics.
> We could technically use Int instead of having a Bool type (just using 1 and 0).  We don’t do that since Int and Bool have intrinsically different meanings in code.  
> What I am saying is that parameters that take the range 0 to 1 typically have a fundamentally different meaning (or at least a different way of thinking about them) than Doubles.  It would be nice to be able to see that distinction when using APIs.
> With both this and the Angle type, I am pointing out areas where, due to historical reasons in C, we have conflated a bunch of types which have different behavior, and then just expect programmers to be conscientious enough to use them correctly in each case.  These types/numbers all have a different forms of dimensionality.
> I’d like to discuss that before we lock everything down.

+1 (although I think a “normalized to [0, 1]” type would be more useful than a “percentage” type)

- Dave Sweeris

More information about the swift-evolution mailing list