google / google/jsonnet

Special syntax for `std.trace` – similar to assert

Open
#825 1 comment 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Jsonnet
Stars
7.6k
Forks
475
PR merge metrics
No merged PRs in 30d

Description

Debugging with std.trace can be annoying, because a large part of the code may need to be parenthesized. It would be nicer if the following syntax was possible:

```
trace foo;
[rest of the code]
```

Instead of:

```
std.trace(
foo,
[rest of the code]
)
```

It raises a question whether we have a similar problem with normal functions. I think it's much less of an issue, because trace statements are expected to be added and removed very quickly ad-hoc during debugging, so dealing with formatting and indentation is most painful for it. Also it is used for side-effects and tracing in some sense doesn't care about the rest of the code following it, so this syntax makes sense for it.

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.