DUX-5330 eval: Only interpret modules once#454
Merged
Conversation
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.
0c3e611 to
c3fcb9e
Compare
dtpowl
approved these changes
Jun 10, 2026
This was referenced Jun 15, 2026
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/`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When running eval comments, we
:addthe 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.