Details
-
Improvement
-
Status: Backlog
-
Major - P3
-
Resolution: Unresolved
-
None
-
None
Description
Autoclosures can be useful to avoid evaluating expensive expressions that may not end up getting used.
For example, SWIFT-105 introduces a mobile logging API where the user provides a logging callback that takes in a few autoclosures that return strings. The autoclosures are only evaluated if the user actually uses those parameters. So if the user never wants to consume one of the fields or decides to discard a message based on its log level, we don't perform the expensive copy into a Swift string.
There are likely other places in the API that could be improved by using autoclosures. we should investigate and create tickets for them.