I am starting to learn Motoko and I am walking through the documentations which is fantastically written, but I am missing a playground where I want to just play with the code.
Is there something like that or even a REPL where I can write Motoko code and just run without having to run all the setup?
I am talking about something like this https://www.typescriptlang.org/play
If you’re already reading the documentation at Motoko Programming Language :: Internet Computer every(most) code block in there already is such a playground. You can change them and press the
Run button in the top-right to evaluate the code.
Thanks I didn’t know that you can change the code.
Although this works, however I would recommend an improvement on this to be a stand alone page.
I put together a playground couple days ago. Not much, just the doc snippet moved to a standalone page.
Word of warning though. The playground supports both more features (eg. recursive actor classes) and fewer features (eg. cycle transfer, state rollback on trap) than code that is compiled to run on the internet computer. This is because it’s a simple interpreter designed to exercise some but not all of language design.
But thanks for doings this!
How feasible is it to compile moc to Wasm so we can have an on-chain compiler? What about to JS so we can build web IDEs?
OCaml to Wasm support is not great. But we do have a JS version of moc, and will have a web IDE coming up in a few weeks
This would be nice to have on canlista!
How do I add it to canlista?
Edit: found it
What’s an easier/more elegant way to use the interpreter code instead of relying on the compiled code, so we can build on that.