Skip to content

♻️ Move debug function to builtin.mq#1218

Merged
harehare merged 2 commits intomainfrom
refactor/debug-function
Feb 4, 2026
Merged

♻️ Move debug function to builtin.mq#1218
harehare merged 2 commits intomainfrom
refactor/debug-function

Conversation

@harehare
Copy link
Copy Markdown
Owner

@harehare harehare commented Feb 4, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 4, 2026 13:39
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

This PR refactors the debug function by moving it from Rust builtin implementation to a mq language implementation in builtin.mq. This simplifies the codebase by implementing the debug functionality in pure mq code rather than as a native Rust builtin function.

Changes:

  • Removed the native Rust implementation of the DEBUG builtin function
  • Added a pure mq implementation of the debug function in builtin.mq
  • Cleaned up associated hash constants, function lookup mappings, and documentation entries

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
crates/mq-lang/src/eval/builtin.rs Removed the native Rust DEBUG builtin function definition, its hash constant, lookup mapping, and documentation entry
crates/mq-lang/builtin.mq Added new mq language implementation of the debug function with equivalent functionality


# Prints the debug information of the given value(s).
def debug(*args):
if (len(args) == 1):
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

The conditional check len(args) == 1 doesn't handle the case where args is empty. The original Rust implementation accepted 1 to u8::MAX arguments, but this version may behave unexpectedly with zero arguments.

Suggested change
if (len(args) == 1):
if (len(args) == 0):
stderr("DEBUG: (no arguments)")
elif (len(args) == 1):

Copilot uses AI. Check for mistakes.
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Feb 4, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing refactor/debug-function (c5f8ce5) with main (36d9517)1

Summary

✅ 29 untouched benchmarks

Footnotes

  1. No successful run was found on main (e4b7216) during the generation of this report, so 36d9517 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@harehare harehare merged commit 73ed7c3 into main Feb 4, 2026
7 checks passed
@harehare harehare deleted the refactor/debug-function branch February 4, 2026 14:29
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