When creating a lazy variable, maybe we should allow for default closures,
i.e

lazy var userSession: UserSession

Which will construct that object for you
instead of having to do:

lazy var object: MyObject {

        let userSession = UserSession()

        return userSession

}()

If the initializer requires parameter values then as an extension of this
we could pass them in psuedo C++ style:

lazy var object: UserSession(otherVariable)

Potentially otherVariable in this case could be lazily processed, so that
its the equivalent of:

lazy var object: MyObject {

        let userSession = UserSession(otherVariable)

        return userSession

}()

-- 
 Wizard
[email protected]
+44 7523 279 698
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to