Swift has a way to defer argument evaluation without making it explicit at call site using @autoclosure. The argument is wrapped in a closure inside the function body and may be called to realise the argument expression – or not called because it wasn’t needed.
Swift has a way to defer argument evaluation without making it explicit at call site using
@autoclosure
. The argument is wrapped in a closure inside the function body and may be called to realise the argument expression – or not called because it wasn’t needed.https://docs.swift.org/swift-book/LanguageGuide/Closures.html#ID543
Why “deferred argument evaluation” instead of “lazy evaluation”?
I thought this might be about the recent work to add lazy argument evaluation to LLVM: https://www.reddit.com/r/Compilers/comments/vp0zz6/lazification_of_function_arguments/