Skip to content

♻️ refactor(lang): organize constants into submodules and improve builtin variable scoping#1236

Merged
harehare merged 1 commit intomainfrom
refactor/organize-constants-and-builtin-scoping
Feb 9, 2026
Merged

♻️ refactor(lang): organize constants into submodules and improve builtin variable scoping#1236
harehare merged 1 commit intomainfrom
refactor/organize-constants-and-builtin-scoping

Conversation

@harehare
Copy link
Copy Markdown
Owner

@harehare harehare commented Feb 9, 2026

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.

…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.
Copilot AI review requested due to automatic review settings February 9, 2026 12:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::builtins and constants::identifiers, updating call sites across lexer/parser/evaluator.
  • Updated several builtin function implementations to use do ... end blocks 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 {
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Feb 9, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing refactor/organize-constants-and-builtin-scoping (e161bc4) with main (7476aba)

Summary

✅ 29 untouched benchmarks

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 9, 2026

@harehare I've opened a new pull request, #1237, to work on those changes. Once the pull request is ready, I'll request review from you.

@harehare harehare merged commit 29c0239 into main Feb 9, 2026
7 checks passed
@harehare harehare deleted the refactor/organize-constants-and-builtin-scoping branch February 9, 2026 13:00
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.

3 participants