Re: [swift-evolution] [Pitch] mutable `newValue` in willSet

2016-09-11 Thread Charlie Monroe via swift-evolution
The current solution is IMHO fine if you implement the property. Once you're overriding it, I don't think it's pretty that you need to override the getter as well: override var bounds: CGRect { get { return super.bounds } set { var bounds

Re: [swift-evolution] [Pitch] mutable `newValue` in willSet

2016-09-11 Thread Xiaodi Wu via swift-evolution
I've run up against this too and had a similar thought. But on reflection I think the current "workaround" is actually the superior solution. Even though in your example it's very clear that newValue is being mutated, if newValue were mutable, it would be possible to *accidentally* mutate it witho

[swift-evolution] [Pitch] mutable `newValue` in willSet

2016-09-11 Thread Karl via swift-evolution
Sometimes you would like to modify the value being set to a property before it is set. Currently, you would have to add a separate backing property and implement the getter and setter, even if you want to perform a simple bounds-check on the value being set and want to cap it to allowed values.

Re: [swift-evolution] SE-0138 UnsafeRawBufferPointer

2016-09-11 Thread Andrew Trick via swift-evolution
> On Sep 11, 2016, at 2:29 PM, Rick Mann wrote: > > Thanks, Andrew. In my case, the Data reads from a file, and since the raw > access is wrapped around the LZMA decompression, I think it should be safe > (no one else is accessing the data at that time). > > I'll just wait for Foundation.Data

Re: [swift-evolution] SE-0138 UnsafeRawBufferPointer

2016-09-11 Thread Rick Mann via swift-evolution
Thanks, Andrew. In my case, the Data reads from a file, and since the raw access is wrapped around the LZMA decompression, I think it should be safe (no one else is accessing the data at that time). I'll just wait for Foundation.Data to be updated and update my code then. > On Sep 10, 2016, at

Re: [swift-evolution] SE-0138 UnsafeRawBufferPointer

2016-09-11 Thread Andrew Trick via swift-evolution
> On Sep 11, 2016, at 3:07 AM, Ben Rimmington wrote: > > >> On 11 Sep 2016, at 01:53, Andrew Trick wrote: >> >> https://github.com/apple/swift-evolution/blob/master/proposals/0138-unsaferawbufferpointer.md >> >> The review period has been extended until September 14. The >> UnsafeRawBufferPo

Re: [swift-evolution] [Pre-Proposal-Discussion] Union Type - Swift 4

2016-09-11 Thread Thorsten Seitz via swift-evolution
> Am 11.08.2016 um 04:58 schrieb Cao, Jiannan via swift-evolution > : > > It is no a mistake. since fn1: (A|B)->Void is subtype of fn0: A->Void That is correct as (A|B) is a supertype of A and it occurs in a contravariant position (argument position) of the funcion type, so (A|B) -> Void is a

Re: [swift-evolution] SE-0138 UnsafeRawBufferPointer

2016-09-11 Thread Ben Rimmington via swift-evolution
> On 11 Sep 2016, at 01:53, Andrew Trick wrote: > > https://github.com/apple/swift-evolution/blob/master/proposals/0138-unsaferawbufferpointer.md > > The review period has been extended until September 14. The > UnsafeRawBufferPointer type name is settled, but we still need to come up > with a