Re: [swift-evolution] [swift-evolution-announce] [Review] SE-0080: Failable Numeric Conversion Initializers

2016-05-06 Thread Dave Abrahams via swift-evolution
on Wed May 04 2016, Colin Barrett wrote: >> Swift numeric types all currently have a family of conversion > initializers. In many use cases they leave a lot to be > desired. Initializing an integer type with a floating point value will > truncate any fractional

Re: [swift-evolution] [swift-evolution-announce] [Review] SE-0080: Failable Numeric Conversion Initializers

2016-05-05 Thread Max Moiseev via swift-evolution
Hi Matthew, In general, if you think there is something to be updated in the proposal, it is worth creating a new revision (like in the floating point protocols proposal, for example) and mentioning it in the thread. I think it is a way to go in this particular case, since we are still in the

Re: [swift-evolution] [swift-evolution-announce] [Review] SE-0080: Failable Numeric Conversion Initializers

2016-05-05 Thread Matthew Johnson via swift-evolution
Sent from my iPhone > On May 5, 2016, at 5:19 PM, Max Moiseev via swift-evolution > wrote: > > Hi all, > > This email is the result of a discussion between members of the standard > library team. > > We suggest changing the initializers argument label to

Re: [swift-evolution] [swift-evolution-announce] [Review] SE-0080: Failable Numeric Conversion Initializers

2016-05-05 Thread Max Moiseev via swift-evolution
Hi all, This email is the result of a discussion between members of the standard library team. We suggest changing the initializers argument label to `exactly` to match the one used in the floating point protocols proposal

Re: [swift-evolution] [swift-evolution-announce] [Review] SE-0080: Failable Numeric Conversion Initializers

2016-05-04 Thread Colin Barrett via swift-evolution
Thanks Matthew. Personally I would really like to see an analysis of the tradeoffs therein covered in the proposal in some way. -Colin (via thumbs) > On May 4, 2016, at 8:23 PM, Matthew Johnson wrote: > > >>> On May 4, 2016, at 6:56 PM, Colin Barrett via

Re: [swift-evolution] [swift-evolution-announce] [Review] SE-0080: Failable Numeric Conversion Initializers

2016-05-04 Thread Matthew Johnson via swift-evolution
> On May 4, 2016, at 6:56 PM, Colin Barrett via swift-evolution > wrote: > >> Swift numeric types all currently have a family of conversion initializers. >> In many use cases they leave a lot to be desired. Initializing an integer >> type with a floating point

Re: [swift-evolution] [swift-evolution-announce] [Review] SE-0080: Failable Numeric Conversion Initializers

2016-05-04 Thread Colin Barrett via swift-evolution
> Swift numeric types all currently have a family of conversion initializers. > In many use cases they leave a lot to be desired. Initializing an integer > type with a floating point value will truncate any fractional portion of the > number. Initializing with an out-of-range value traps.

Re: [swift-evolution] [swift-evolution-announce] [Review] SE-0080: Failable Numeric Conversion Initializers

2016-05-04 Thread Stephen Canon via swift-evolution
First, a general +1 to these, thanks for proposing them. In SE-0067 we spelled these “exactly” rather than “exact”. init?(exactly value: Source) As for –0, Int(exactly: -0.0) should *not* fail. My rationale for this is as follows: - While information (the signbit) is lost, the essential