Re: [swift-evolution] [Pitch] Guard/Catch

2017-07-07 Thread Elviro Rocca via swift-evolution
Amazing proposal, I love it and thinking back there's plenty of times where I would have used the guard-catch instead of the non-swifty (to me) do-catch. A guard-catch construct still allows to handle errors explicitly, with the added convenience of forcing a return inside the catch, which is ba

[swift-evolution] [Proposal] Introduces endianness specific type

2017-07-07 Thread Susan Cheng Team Garment via swift-evolution
IMO, it has unclear representation when FixedWidthInteger working with endianness specific type. so I want to introduce the endianness specific wrapper: public struct BEInteger : FixedWidthInteger { public var bigEndian: BEInteger { get } public var littleEndian: LEInteger { get }

Re: [swift-evolution] [Proposal] Introduces endianness specific type

2017-07-07 Thread Max Moiseev via swift-evolution
Hi Susan, Was there any motivation for this proposal that I missed? If not then, can you please provide it in a few sentences? Otherwise it’s not clear to me what problem it is supposed to fix. Thanks, Max > On Jul 6, 2017, at 8:21 PM, Susan Cheng via swift-evolution > wrote: > > IMO, it

Re: [swift-evolution] [Pitch] KeyPath based map, flatMap, filter

2017-07-07 Thread Max Moiseev via swift-evolution
A few more observations not necessarily supporting either side: - Why only map, flatMap, and filter? drop, prefix, and sorted can also benefit from keyPaths. - Adding these overloads only to Sequence will have a very interesting side effect on code like: xs.lazy.map(\.name), because lazy. Theref

Re: [swift-evolution] [Pitch] Guard/Catch

2017-07-07 Thread Dave DeLong via swift-evolution
What about the situation where you have: func doSomething() throws → Result? { … } How would you handle both the catch and the let binding of the result? Dave > On Jul 7, 2017, at 7:55 AM, Elviro Rocca via swift-evolution > wrote: > > Amazing proposal, I love it and thinking back there's ple

Re: [swift-evolution] [Pitch] KeyPath based map, flatMap, filter

2017-07-07 Thread Hooman Mehr via swift-evolution
Considering these observations and more from Brent and Dave, I support ultimately making KeyPath) a subtype of (T)->U as suggested. If someone really wants this now, I would go with a prefix operator as a stopgap: prefix operator ~ prefix func ~(lhs: KeyPath) -> (T)->U { return { $0[keyPath: l

Re: [swift-evolution] [Pitch] KeyPath based map, flatMap, filter

2017-07-07 Thread Dave Abrahams via swift-evolution
on Thu Jul 06 2017, Brent Royal-Gordon wrote: >> On Jul 6, 2017, at 9:13 AM, Dave Abrahams wrote: >> >> I'm not sure what you're objecting to about this. Is it the very >> appearance of curly braces? > > I went to bed thinking that maybe I should have explained that better, > and I guess I wa

Re: [swift-evolution] [Proposal] Introduces endianness specific type

2017-07-07 Thread Susan Cheng via swift-evolution
Here are two problems being fixed. First, considering the example: struct MyRawDataStruct { var size: UInt32 var signature: UInt32 var width: UInt32 var height: UInt32 } The type UInt32 doesn't tall us the endianness of the value. Also, if we read the value of it, the v