From fc63594631590547c9a31001806095f2e079a20e Mon Sep 17 00:00:00 2001 From: Aspen Smith Date: Thu, 4 Jul 2024 23:46:20 -0400 Subject: feat(tvix/repl): Allow binding variables at the top-level MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow binding variables at the REPL's toplevel in the same way the Nix REPL does, using the syntax = . This fully, strictly evaluates the value and sets it in the repl's "env", which gets passed in at the toplevel when evaluating expressions. The laziness behavior differs from Nix's, but I think this is good: ❯ nix repl Welcome to Nix version 2.3.18. Type :? for help. nix-repl> x = builtins.trace "x" 1 nix-repl> x trace: x 1 nix-repl> x 1 vs tvix: tvix-repl> x = builtins.trace "x" 1 trace: "x" :: string tvix-repl> x => 1 :: int tvix-repl> x => 1 :: int Bug: https://b.tvl.fyi/issues/371 Change-Id: Ieb2d626b7195fa87be638c9a4dae2eee45eb9ab1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11954 Reviewed-by: flokli Tested-by: BuildkiteCI Autosubmit: aspen --- tvix/Cargo.nix | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tvix/Cargo.nix') diff --git a/tvix/Cargo.nix b/tvix/Cargo.nix index 4d6e1d94628f..bf0958407907 100644 --- a/tvix/Cargo.nix +++ b/tvix/Cargo.nix @@ -13845,10 +13845,18 @@ rec { name = "rnix"; packageId = "rnix"; } + { + name = "rowan"; + packageId = "rowan"; + } { name = "rustyline"; packageId = "rustyline"; } + { + name = "smol_str"; + packageId = "smol_str"; + } { name = "thiserror"; packageId = "thiserror"; -- cgit 1.4.1