Details
-
New Feature
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
None
-
None
-
Platform Core
-
New Feature
-
It is now possible to resolve a {{Deferred}} value by using the {{call}} function. It can resolve a deferred function call, and a deferred variable dereference (with support to {{dig}} into a structured value).
-
Needs Assessment
Description
While the primary use of a Deferred is to defer the evaluation to catalog apply time it is very useful to also be able to resolve values when compiling:
- For the purpose of testing Deferred values
- To delay the evaluation of an expensive function until it is actually needed
- To delay a reference to a variable that may not yet exist
The same can be achieved without Deferred by instead of creating a Deferred the information would be encoded in a hash or array, and the receiver making a call to call or other functions (typically an ERB template) to get a variable value via indirect name reference.
See PUP-8635 for the Deferred data type.