Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new Eval abstraction to unify strict and lazy evaluation plumbing across the sjsonnet interpreter/runtime, updating stdlib and core evaluator code to use .value instead of .force and broadening APIs from Lazy to Eval.
Changes:
- Add
Eval(plusCoEval) and refactorLazy/Valto implementEvalvia.value. - Update builtin/std-lib function signatures and internal evaluation sites from
Lazy/.forcetoEval/.value. - Rename
Val.Str’s underlying string field (value→str) and propagate updates throughout parser/optimizer/evaluator/materializer/stdlib.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| sjsonnet/test/src/sjsonnet/CustomValTests.scala | Updates custom builtin test to accept Eval and use .value. |
| sjsonnet/test/src-jvm-native/sjsonnet/BaseFileTests.scala | Updates test native function signature and materialization to use Eval. |
| sjsonnet/test/src-js/sjsonnet/BaseFileTests.scala | Updates JS tests/stubs to use Eval and .value. |
| sjsonnet/src/sjsonnet/stdlib/TypeModule.scala | Refactors type predicates/assertEqual/equals helpers to Eval + .value. |
| sjsonnet/src/sjsonnet/stdlib/StringModule.scala | Refactors string stdlib to Eval, updates format specialization and array element types. |
| sjsonnet/src/sjsonnet/stdlib/StdLibModule.scala | Refactors native, trace, and extVar plumbing to use Eval. |
| sjsonnet/src/sjsonnet/stdlib/SetModule.scala | Refactors set operations to Eval, including internal array element types and key extraction. |
| sjsonnet/src/sjsonnet/stdlib/ObjectModule.scala | Refactors object helpers and prune/mergePatch paths to Eval. |
| sjsonnet/src/sjsonnet/stdlib/NativeRegex.scala | Refactors regex builtins to accept Eval arguments. |
| sjsonnet/src/sjsonnet/stdlib/MathModule.scala | Refactors mod builtin to Eval and .value. |
| sjsonnet/src/sjsonnet/stdlib/ManifestModule.scala | Refactors manifest/parse/deepJoin/lines/toml logic to Eval. |
| sjsonnet/src/sjsonnet/stdlib/EncodingModule.scala | Refactors md5 builtin to accept Eval. |
| sjsonnet/src/sjsonnet/stdlib/ArrayModule.scala | Refactors array stdlib functions to Eval, updating internal builders/queues/arrays. |
| sjsonnet/src/sjsonnet/functions/FunctionBuilder.scala | Refactors typed builtin wrappers to read args from .value. |
| sjsonnet/src/sjsonnet/ValVisitor.scala | Updates JSON-to-Val visitor to build arrays of Eval. |
| sjsonnet/src/sjsonnet/ValScope.scala | Changes scope bindings storage from Array[Lazy] to Array[Eval]. |
| sjsonnet/src/sjsonnet/Val.scala | Introduces Eval/CoEval, migrates LazyWithComputeFunc + Val to .value, updates Val.Str field name and Val.Arr element type. |
| sjsonnet/src/sjsonnet/StaticOptimizer.scala | Updates string-constant optimizations to use Val.Str.str. |
| sjsonnet/src/sjsonnet/Parser.scala | Updates parser internals for Eval arrays and Val.Str.str. |
| sjsonnet/src/sjsonnet/Materializer.scala | Updates reverse-materialization array element type to Eval. |
| sjsonnet/src/sjsonnet/Format.scala | Refactors format handling to Eval and .value. |
| sjsonnet/src/sjsonnet/Evaluator.scala | Refactors evaluator to store/propagate Eval in scopes and builtin application arrays; updates string accessors. |
| sjsonnet/src-jvm/sjsonnet/stdlib/NativeXz.scala | Updates JVM xz builtin to accept Eval. |
| sjsonnet/src-jvm-native/sjsonnet/stdlib/NativeGzip.scala | Updates gzip builtin to accept Eval. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f6dbfb6 to
0addd77
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 25 out of 25 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0940873 to
d715cf7
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 26 out of 26 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Motivation:
Introduce
Evaltrait, makeLazytrait entendsEval.