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
james@supmenow.com
+44 7523 279 698
Have you heard of the property behaviors proposal?
Félix
···
Le 5 janv. 2016 à 08:48:03, James Campbell via swift-evolution <swift-evolution@swift.org> a écrit :
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
james@supmenow.com <mailto:james@supmenow.com>
+44 7523 279 698
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution