Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve debugability of generated JS code #228

Open
1 of 6 tasks
LPTK opened this issue Nov 4, 2024 · 0 comments
Open
1 of 6 tasks

Improve debugability of generated JS code #228

LPTK opened this issue Nov 4, 2024 · 0 comments
Assignees

Comments

@LPTK
Copy link
Contributor

LPTK commented Nov 4, 2024

  • Print runtime error stack traces
  • Generate sanity checks as part of the JS code (with a flag to disable that when more performance is needed):
    • check argument numbers
    • check result of field selections is not undefined
  • Add a flag to instrument generated JS so we can see what the program is doing in terms of the usual indented traces with function arguments and results
    Add a Debug.mls file to hkmc2/shared/src/test/mlscript-compile, to be imported implicitly, where the tracing logic is implemented in MLscript.
  • Add fun by-name parameters: for example, fun foo(fun thunk) = if ... then thunk else ()

For points 2 and 3, don't modify the Lowering.scala code directly: instead, make a trait to be mixed in that overrides selected functions from it. Modularize Lowering.scala as needed.

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

No branches or pull requests

2 participants