[swift-evolution] [Proposal] Property behaviors

Jacob Bandes-Storch jtbandes at gmail.com
Tue Jan 26 13:40:04 CST 2016


On Tue, Jan 26, 2016 at 9:14 AM, Joe Groff via swift-evolution <
swift-evolution at swift.org> wrote:

> `lazy var`s still can't refer to self today AFAIK (I know we tried to fix
> that, but we still get plenty of radars saying it doesn't work…), so I
> don't think it would be a regression for a behavior implementation not to
> immediately be able to either. (And I'm not proposing we immediately
> replace our existing 'lazy' implementation immediately either.)
>

They can; it just requires a type annotation.

class C {
    lazy var b: B = B(c: self)
}

struct B {
    let c: C
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160126/4154edad/attachment.html>


More information about the swift-evolution mailing list