Conversation
…ltin variable scoping Reorganize flat constants into `builtins` and `identifiers` submodules for better code organization. Refactor builtin functions (take_while, group_by, fold, unique_by) to use `do...end` blocks for proper mutable variable scoping.
There was a problem hiding this comment.
Pull request overview
Refactors mq-lang constants into clearer submodules and adjusts builtin implementations to improve mutable variable scoping.
Changes:
- Split AST constants into
constants::builtinsandconstants::identifiers, updating call sites across lexer/parser/evaluator. - Updated several builtin function implementations to use
do ... endblocks to constrain mutable variable scope. - Updated builtin documentation keys and hashing constants to reflect the new constant organization.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/mq-lang/src/lexer.rs | Updates keyword parsing to use constants::identifiers. |
| crates/mq-lang/src/eval/builtin.rs | Updates builtin naming references, hash constants, and doc map keys to the new constants layout. |
| crates/mq-lang/src/eval.rs | Updates debugger builtin name reference to constants::builtins. |
| crates/mq-lang/src/cst/parser.rs | Updates wildcard identifier constant reference to constants::identifiers. |
| crates/mq-lang/src/ast/parser.rs | Repoints builtin identifiers used by the AST parser to constants::builtins/constants::identifiers. |
| crates/mq-lang/src/ast/constants.rs | Introduces builtins and identifiers submodules for constants organization. |
| crates/mq-lang/builtin.mq | Refactors builtin implementations to use do ... end for scoping and minor syntax updates. |
| pub const ASSIGN: &str = "assign"; | ||
|
|
||
| pub const PATTERN_MATCH_WILDCARD: &str = "_"; | ||
| pub mod builtins { |
There was a problem hiding this comment.
Public modules builtins and identifiers were introduced without rustdoc. Please add brief module-level /// docs explaining the intended distinction (e.g. builtin function names vs reserved identifiers) to keep API documentation consistent and reduce ambiguity for future contributors.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
|
Reorganize flat constants into
builtinsandidentifierssubmodules for better code organization. Refactor builtin functions (take_while, group_by, fold, unique_by) to usedo...endblocks for proper mutable variable scoping.