[swift-evolution] Epic: Typesafe calculations

Erica Sadun erica at ericasadun.com
Thu Jan 21 16:14:10 CST 2016


I vaguely remember having the discussion on this so the compiler could catch, for example:

typealias MyQuantityType = Int
typealias MyCounterType = Int

let x: MyQuantityType = 2
let y: MyCounterType = 3

x something blah something y // COMPILER ERROR

-- E


> On Jan 21, 2016, at 2:58 PM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
> on Thu Jan 21 2016, Erica Sadun <swift-evolution at swift.org> wrote:
> 
>> Going off the top of my head, I'd imagine it's a product type that
>> inherits memory layout, code reuse, and conformances but introduces a
>> distinct type for type safety checks. 
> 
> FWIW, that's definitely not what *I'm* talking about, though some of the
> people in this thread may have meant that.
> 
> -Dave
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list