[swift-evolution] [Proposal] Memorization for running function only once

Muse M james.lei65 at gmail.com
Fri May 6 19:33:07 CDT 2016


I propose* "*memorization" or "memo" 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.

memo func hello(fname: String, lname: String) {
   return fname.lname

This is useful for certain case for web application and value that don't
need change once executed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160507/eea74d41/attachment.html>

More information about the swift-evolution mailing list