diff --git a/src/libexpr/nix_api_expr.h b/src/libexpr/nix_api_expr.h index 1211c587f..94eaa5a6c 100644 --- a/src/libexpr/nix_api_expr.h +++ b/src/libexpr/nix_api_expr.h @@ -97,9 +97,15 @@ nix_err nix_value_call(nix_c_context *context, State *state, Value *fn, /** * @brief Forces the evaluation of a Nix value. * + * The Nix interpreter is lazy, and not-yet-evaluated Values can be + * of type NIX_TYPE_THUNK instead of their actual value. + * + * This function converts Values into their final type. + * * @param[out] context Optional, stores error information * @param[in] state The state of the evaluation. * @param[in,out] value The Nix value to force. + * @post values is not of type NIX_TYPE_THUNK * @return NIX_OK if the force operation was successful, an error code * otherwise. */ @@ -108,6 +114,11 @@ nix_err nix_value_force(nix_c_context *context, State *state, Value *value); /** * @brief Forces the deep evaluation of a Nix value. * + * Recursively calls nix_value_force + * + * @see nix_value_force + * @warning Calling this function on a recursive data structure will cause a + * stack overflow. * @param[out] context Optional, stores error information * @param[in] state The state of the evaluation. * @param[in,out] value The Nix value to force. diff --git a/src/libutil/nix_api_util.h b/src/libutil/nix_api_util.h index 98c837a84..4a7f6c4cd 100644 --- a/src/libutil/nix_api_util.h +++ b/src/libutil/nix_api_util.h @@ -23,7 +23,8 @@ extern "C" { * @brief Dealing with errors from the Nix side * * To handle errors that can be returned from the Nix API, - * a nix_c_context can be passed to any function that potentially returns an error. + * a nix_c_context can be passed to any function that potentially returns an + * error. * * Error information will be stored in this context, and can be retrieved * using nix_err_code and nix_err_msg.