> On Apr 13, 2016, at 10:32 AM, Vladimir.S <[email protected]> wrote:
> 
> But in case of struct instance constant - we have a problem:
> 
> struct A {
>    var x = 1
>    var y = 2
> }
> 
> let a1 = A()
> 
> with (a1) {
>    print($0.x)
>    $0.y = 10
> }
> 
> - this will be compiled without errors/warnings, but yes - there will be 
> runtime error. I'm sure this is not what we need from Swift. And so, this 
> "with" function can not be a 100% replacement for special language 
> construction. So, all, please provide your opinion on this proposal and I 
> believe we should move it forward.
> 
> 

My version of `with` doesn't have this issue. However, it's a clear logical 
error on the programmer's part when you treat a value type as a reference type.

-- E
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to