Skip to content

Improve debugability of generated JS code #228

@LPTK

Description

@LPTK
  • 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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions