Skip to content

chore: Introduce Eval trait.#607

Open
He-Pin wants to merge 1 commit intodatabricks:masterfrom
He-Pin:eval
Open

chore: Introduce Eval trait.#607
He-Pin wants to merge 1 commit intodatabricks:masterfrom
He-Pin:eval

Conversation

@He-Pin
Copy link
Contributor

@He-Pin He-Pin commented Feb 18, 2026

Motivation:
Introduce Eval trait, make Lazy trait entends Eval.

Copilot AI review requested due to automatic review settings February 18, 2026 09:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 (plus CoEval) and refactor Lazy/Val to implement Eval via .value.
  • Update builtin/std-lib function signatures and internal evaluation sites from Lazy/.force to Eval/.value.
  • Rename Val.Str’s underlying string field (valuestr) 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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

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.

1 participant

Comments