about summary refs log tree commit diff
path: root/lisp
diff options
context:
space:
mode:
authorAspen Smith <root@gws.fyi>2024-07-05T03·46-0400
committerclbot <clbot@tvl.fyi>2024-07-05T16·40+0000
commitfc63594631590547c9a31001806095f2e079a20e (patch)
treebed08e994d56fb224a62be6ab371f9cd1fec17e6 /lisp
parentac3d717944412b17d7dcd18006c2f9f522b1b3f7 (diff)
feat(tvix/repl): Allow binding variables at the top-level r/8346
Allow binding variables at the REPL's toplevel in the same way the Nix
REPL does, using the syntax <ident> = <expr>. 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 <flokli@flokli.de>
Tested-by: BuildkiteCI
Autosubmit: aspen <root@gws.fyi>
Diffstat (limited to 'lisp')
0 files changed, 0 insertions, 0 deletions