5 ms·
Today I have submitted a proposal for "memorization", "memo", "memorize" keyword for a function that allows to run only once through out the lifecycle in Swift
by proyb2 10y ago
Today I have submitted a proposal for "memorization", "memo", "memorize" keyword for a function that allows to run only once through out the lifecycle in Swift 3. Repeatedly execute the function will only return the same result without having to rerun the function everytime. As far as, I don't see my submission is being visible for discussion.
memo func hello(fname: String, lname: String) {
return fname.lname
}
- seanalltogether 10y agoIs this not better suited to GCD operations? dispatch_once handles this exact use case.
- johndifool 10y agoHow about using `lazy` for a memoized function?
- proyb2 10y agoHaven't had experience in GCD, looks interesting, are there any tutorials I can read up other than Apple resources?