google / google/jsonnet

Dictionaries with no sense of self

Open
#220 6 comments 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

I find that most of the time I'm writing jsonnet, having an object bring a magic `self` into scope is a bit of a pain. I usually end up having to define a `local realSelf = self` in the outer scope to retain the `self` that I actually wanted.

Can we have raw dictionaries with no magic `self` in scope for those times we just want to operate on a pure datastructure?

This is _almost_ the opposite of the `rec` keyword in Nix. For context, `rec` brings a dictionary's keys into scope within that dictionary, and the default is to have no access to the equivalent of `self`. I'm not proposing changing the default at this stage, but it would be nice to have a way to opt out.

cc @roconnor, since whenever I mention Nix @sparkprime cc's him anyway 😄

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.