[swift-evolution] Representation of natural numbers with a distinct type

David Turnbull dturnbull at gmail.com
Thu Feb 4 11:46:52 CST 2016


On Thu, Feb 4, 2016 at 3:48 AM, James Froggatt <conductator at ntlworld.com>
wrote:

> CGSize represents vectors *and* sizes? And an explicit ‘normalisation’ (a
> non-negative safety check) must be performed to work with CGSize as a size?
> This sounds awfully like a lack of type safety.
>

That's an invariant. Enforcing y>=x with a type system is just as hard as
the halting problem.

-david
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160204/10596c6b/attachment.html>


More information about the swift-evolution mailing list