[wasm-lib PR] Adding a general purpose console.log() import

Many WebAssembly tutorials, including the example code on MDN, use a "console" "log" import. I thought it would be good to add this import to the WasmRunner used for the exercises to avoid confusion when people copy/paste example code into their Exercism exercise.

If you’re a WASM beginner (like me) you might not even realize that the "console" "log" import has to be defined somewhere ahead of time.

WasmRunner has plenty of alternative logging functions (including log_i32_u() that is also just a console.log() call) but it’s not obvious they exist if you don’t look into this source file (or, I just came across them, some Markdown documentation files that are not linked on the track, I think?)

Link to the PR: Add a general purpose console.log() import. by Terr · Pull Request #11 · exercism/wasm-lib · GitHub

1 Like

Thank you so much for this post! Whether the PR happens or not, I have now learned that the log_i32_u function exists, which I think will help me get unstuck! (I have no idea how I would have discovered those logging functions otherwise.)

FYI: As of yesterday, documentation for these functions should be populated in the help file for CLI users. Web users should see it in the sidebar of each exercise as before.

2 Likes