nushell/crates/nu-engine
Ian Manske 7d2e8875e0
Make timeit take only closures as an argument (#14483)
# Description

Fixes #14401 where expressions passed to `timeit` will execute twice.
This PR removes the expression support for `timeit`, as this behavior is
almost exclusive to `timeit` and can hinder migration to the IR
evaluator in the future. Additionally, `timeit` used to be able to take
a `block` as an argument. Blocks should probably only be allowed for
parser keywords, so this PR changes `timeit` to instead only take
closures as an argument. This also fixes an issue where environment
updates inside the `timeit` block would affect the parent scope and all
commands later in the pipeline.

```nu
> timeit { $env.FOO = 'bar' }; print $env.FOO
bar
```

# User-Facing Changes

`timeit` now only takes a closure as the first argument.

# After Submitting

Update examples in the book/docs if necessary.
2024-12-10 23:08:53 +08:00
..
src Make timeit take only closures as an argument (#14483) 2024-12-10 23:08:53 +08:00
Cargo.toml Start to Add WASM Support Again (#14418) 2024-11-30 07:57:11 -06:00
LICENSE Fix rest of license year ranges (#8727) 2023-04-04 09:03:29 +12:00
README.md Add top-level crate documentation/READMEs (#12907) 2024-07-14 10:10:41 +02:00

This crate primarily drives the evaluation of expressions.

(Some overlap with nu-protocol)

  • Provides CallExt

Internal Nushell crate

This crate implements components of Nushell and is not designed to support plugin authors or other users directly.