google / google/jsonnet

std.deepForce - recursively force all parts of a value

Open
#779 3 comments 0 reactions 0 assignees View on GitHub
stdlib
Dominant language
Jsonnet
Stars
7.6k
Forks
475
PR merge metrics
No merged PRs in 30d

Description

It can be useful for:
(a) troubleshooting - it can be temporarily added to simplify the stack traces when some value is used somewhere deeply
(b) improve stack traces for functions which will traverse the value anyway - e.g. custom manifesters.
(c) optimizing memory usage (may be tricky to get right).

A function like this can be already implemented with Jsonnet. One way to do so is to use `assert` to force object fields/array elements and then return the value itself (assert allows us to actually calculate something, but return a completely different thing). It needs to be a builtin for it to really make sense (otherwise both performance and stack traces would probably suffer).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.