> On 04 Jul 2016, at 21:12, Mark Dalrymple <[email protected]> wrote:
> 
> lazy var c:Int = {return self.a * self.b}()
> 
> It's in a closure, so need to explicitly reference self.

Oh of course, I got tripped up by the similarity of TestStruct1 and TestStruct2.
Problem solved.

BTW this compiles:


                        struct TestStruct2
                                {
                                lazy var c:Int = {return self.d}()
                                lazy var d:Int = {return self.c}()
                                }

and causes a stack overflow:

var x = TestStruct2()
let y = x.c
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to