Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Jsonnet std lib non-global #166

Merged
merged 3 commits into from
May 30, 2023
Merged

Make Jsonnet std lib non-global #166

merged 3 commits into from
May 30, 2023

Conversation

lihaoyi-databricks
Copy link
Contributor

This serves two purposes:

  1. We think we're seeing race conditions where the lazily-evaluated mutable state in the std lib Val.Obj is causing livelocks when evaluating Jsonnet in a multithreaded environment.

  2. This will allow whoever instantiates sjsonnet.Interpreter to customize the std.*, allowing people to inject their own functions. Useful if google/jsonnet has some new std lib functions that haven't been added to sjsonnet yet, or if you have some domain-specific functions you want to expose in your config

@lihaoyi-databricks
Copy link
Contributor Author

Review by @szeiger

Copy link
Collaborator

@szeiger szeiger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in the longer term we should look into getting a clearer separation of official Jsonnet functions and custom extensions instead of putting non-standard functions into std.

@lihaoyi-databricks
Copy link
Contributor Author

Yeah this change would open up the possibility of defining custom std functions like gzip or xz in the databricks codebase, and other people can define their own std functions easily, rather than having to chuck everything into the shared Std.scala

@szeiger
Copy link
Collaborator

szeiger commented May 31, 2023

What I meant is that we should put them into a separate object (e.g. stdext). I think we already have some non-standard features in std. This makes it hard to tell if a source is compatible with Jsonnet or if it requires non-standard Sjsonnet features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants