[swift-users] Re-initializing lazy vars
David Sweeris
davesweeris at mac.com
Thu Oct 19 21:59:16 CDT 2017
I don't know. IIRC (big if), though, there was talk of adding support for "property behaviors"(?). Resetting lazy vars probably would've been one of them, and if so, it probably got pulled so that we wouldn't risk breaking source compatibility later by adding a consistent syntax for other behaviors. I think. I wish I could remember who'd brought up the idea... they'd probably know straight away if that's what happened.
- Dave Sweeris
> On Oct 19, 2017, at 5:40 PM, Rick Mann via swift-users <swift-users at swift.org> wrote:
>
> Googling for the answer, it seemed some versions of Swift supported setting a lazy var property to nil, such that the next time it's accessed, the initializer would be run again.
>
> But I just tried this in a playground in Swift 4 and it doesn't work.
>
> It sure seems to me like it should work. What's the reasoning for the current behavior?
>
> --
> Rick Mann
> rmann at latencyzero.com
>
>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
More information about the swift-users
mailing list