Skip to content

Improve the output of the debugger#4365

Draft
jkyang92 wants to merge 14 commits into
Macaulay2:developmentfrom
jkyang92:debugger-output
Draft

Improve the output of the debugger#4365
jkyang92 wants to merge 14 commits into
Macaulay2:developmentfrom
jkyang92:debugger-output

Conversation

@jkyang92
Copy link
Copy Markdown
Contributor

This is a draft pull request improving the output of the current line of code in the debugger.

This pull request contains work with @adamlaclair @BrysonKagy @OlaPeteru from the Building the Future of Macaualy2 workshop. Comments welcome, I will still read through this to make sure that nothing is missing and no obvious issues remain.

These commits do not include any AI generated code.

@adamlaclair @BrysonKagy, Can you respond verifying that that the code from your commits can be distributed under GPL2+? (or the public domain or other compatible license if that is not acceptable)

@jkyang92 jkyang92 changed the title Debugger output Improve the output of the debugger May 24, 2026
Comment thread M2/Macaulay2/m2/code.m2
code Function := opt -> f -> codeFunction(null, f, 0)
code Command := opt -> C -> code C#0
code List := opt -> L -> DIV between_(HR{}) dedupMethods apply(L, code)
code ZZ := opt -> i -> code previousMethodsFound#i
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
code ZZ := opt -> i -> code previousMethodsFound#i
code ZZ := opt -> i -> code(previousMethodsFound#i, opt)

code(TestInput) in testing.m2 also needs updated to use options

Comment thread M2/Macaulay2/m2/code.m2


protect PrintCaret
protect PrintLineNum
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm wondering if we should export these, too, so users can pass them to code? If so, then I'd considering using PrintCarets and PrintLineNumbers to match the corresponding debug-prefixed global variables.

We'd also need to update the code docs accordingly.

Comment thread M2/Macaulay2/m2/test.m2
@@ -0,0 +1,29 @@

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Was adding this file just a git oopsie?

Comment thread M2/Macaulay2/m2/code.m2
file = lines file;
if #file < stop then error("line number ",toString stop, " not found in file ", filename);
DIV splice { codeAddress(x), codeContent(start, stop, file) }
DIV splice { codeAddress(x), codeContent(PrintCaret => debugPrintCarets, PrintLineNum => debugPrintLineNumbers, x, start, stop, file) }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It seems like we should use opt here. Maybe the default values should be null, and if so, use the global variables?

Either that or just drop options entirely and use the global variables inside codeContent?

@d-torrance d-torrance added Core Issues involving the Core scripts. Interpreter labels May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Core Issues involving the Core scripts. Interpreter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants