Skip to content

DUX-5330 eval: Only interpret modules once#454

Merged
9999years merged 1 commit into
mainfrom
wiggles/dux-5330/pxlu
Jun 10, 2026
Merged

DUX-5330 eval: Only interpret modules once#454
9999years merged 1 commit into
mainfrom
wiggles/dux-5330/pxlu

Conversation

@9999years

Copy link
Copy Markdown
Member

When running eval comments, we :add the module to interpret it before every eval command, even if we're running multiple eval commands for the same module. Let's only add the module once, no matter how many commands there are.

@linear-code

linear-code Bot commented Jun 10, 2026

Copy link
Copy Markdown

DUX-5330

When running eval comments, we `:add` the module to interpret it before
every eval command, even if we're running multiple eval commands for the
same module. Let's only add the module once, no matter how many commands
there are.
@9999years 9999years force-pushed the wiggles/dux-5330/pxlu branch from 0c3e611 to c3fcb9e Compare June 10, 2026 22:05
@9999years 9999years marked this pull request as ready for review June 10, 2026 22:39
@9999years 9999years requested a review from a team as a code owner June 10, 2026 22:39
@9999years 9999years requested review from csamak and ito-codes June 10, 2026 22:39
@9999years 9999years enabled auto-merge (squash) June 10, 2026 22:40
@9999years 9999years merged commit 9ee9a0e into main Jun 10, 2026
39 checks passed
@9999years 9999years deleted the wiggles/dux-5330/pxlu branch June 10, 2026 22:58
9999years added a commit that referenced this pull request Jun 15, 2026
In #454 I restructured the eval command logic.

Before, the loop looked like this:

```rust
for (path, commands) in eval_commands_by_path {
  for command in commands {
    do_eval_command(command);
  }
}
```

After, I pulled some logic out of the inner loop:

```rust
for (path, commands) in eval_commands_by_path {
  do_common_logic(path);
  for command in commands {
    do_eval_command(command);
  }
  finish_common_logic(path);
}
```

But sometimes `commands` was empty, doing unnecessary work in the best
case and attempting to eval non-Haskell in the worst case!

Let's skip empty entries.

- [ ] Updated the user manual in `docs/`.
- [ ] Added integration / regression tests in `tests/`.
9999years added a commit that referenced this pull request Jun 15, 2026
To actually _execute_ eval commands with the proper bindings in scope,
we need to be able to evaluate (interpret) a file, which requires we
know its module _name_ (because `:module + *MODULE_NAME` only supports
module names and not source paths).

Let's guard adding an entry to the `eval_commands` map by making sure we
can convert the path to a module name.

See also: #458, #454.

- [ ] Updated the user manual in `docs/`.
- [x] Added integration / regression tests in `tests/`.
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.

2 participants