[swift-evolution] [swift-users] Replacement for NSNumber?
Dave Abrahams
dabrahams at apple.com
Mon Apr 11 14:31:58 CDT 2016
on Mon Apr 11 2016, Ross O'Brien <swift-evolution at swift.org> wrote:
> Your pointing to two mutually exclusive protocols proves the point. If I want to
> write a generic function for a numerical type which can be added, I can't just
> require that the type conforms to IntegerArithmeticType because that excludes
> all the floating point types. Protocols for various numerical functions, e.g.
> NumericalArithmeticType, would be handy,
The upcoming proposals for integer and floating point protocols have a
common type called Arithmetic that serves this purpose.
>
>
> On Mon, Apr 11, 2016 at 4:55 PM, Joanna Carter via swift-evolution
> <swift-evolution at swift.org> wrote:
>
> > It’s inconvenient that structs can’t inherit, and so things like Int and
> Double aren’t known as numbers. Should there be a Number protocol that
> encompasses all things number-like?
>
> Taje a look at the IntegerType and FloatingPointType
>
> --
> Joanna Carter
> Carter Consulting
>
> (de mon iPhone)
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> 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
--
Dave
More information about the swift-evolution
mailing list