Re: [swift-evolution] Explicity Size Clipping

2016-01-06 Thread Félix Cloutier via swift-evolution
I don't understand. Can you show a code example? Félix > Le 6 janv. 2016 à 13:02:43, James Campbell via swift-evolution > a écrit : > > I have a overloaded method for a protocol that takes an Int or double. > > I have an issue with swift calling the Int version

[swift-evolution] Explicity Size Clipping

2016-01-06 Thread James Campbell via swift-evolution
I have a overloaded method for a protocol that takes an Int or double. I have an issue with swift calling the Int version when passing in a UInt32 . Ideally I would prefer the compiler to detect I am about to do something which will cause an overflow and throw an error. I would then have to

Re: [swift-evolution] Explicity Size Clipping

2016-01-06 Thread James Campbell via swift-evolution
This is the full code: // // Box.swift // Project // // Created by James Campbell on 06/01/2016. // // // This File implements the Box protocol for Type Safe Alogrithm Types and other useful things. import Foundation //MARK:- Box protocol Box: CustomStringConvertible,

Re: [swift-evolution] Explicity Size Clipping

2016-01-06 Thread James Campbell via swift-evolution
That last line, the value inside the Degree struct should be a Int created from a UInt32 On Wed, Jan 6, 2016 at 7:08 PM, James Campbell wrote: > This is the full code: > > // > > // Box.swift > > // Project > > // > > // Created by James Campbell on 06/01/2016. > > // > >

Re: [swift-evolution] Explicity Size Clipping

2016-01-06 Thread Félix Cloutier via swift-evolution
I either don't understand or can't reproduce the issue. This code: > class Box { > let value: Int > > init(value: Int) { > self.value = value > } > } > > let test: UInt32 = 4 > let box = Box(value: test) does not compile ("foo.swift:10:22: error: cannot