-
-
Notifications
You must be signed in to change notification settings - Fork 678
minimal 'hello world' example #48
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
Conversation
examples/hello-assembly/test.sh
Outdated
| asc hello-assembly.ts -b test.wasm -t test.wast | ||
|
|
||
| node -i -e "log_char = c => process.stdout.write(String.fromCodePoint(c));\ | ||
| new WebAssembly.Instance(new WebAssembly.Module(require('fs').readFileSync('test.wasm')),{console:{log_char}})" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I understand this, it doesn't look simple. Could you please split it in multiple lines with a few comments?
|
What do you guys think of moving examples towards WebAssembly Studio fiddles on the long run? For example, here's one for the Game of Life example. |
|
while https://webassembly.studio will be nice for large projects, We can link to both Assembleash and webassembly.studio and keep the examples folder for people who prefer their terminal. |
|
@xtuc agreed, I over-optimized for brevity, not readability. fixed |
Yes that's a good idea, people would get a feeling by playing with it. |
|
WasmFiddle for AssemblyScript would be ideal IDE for starters IMHO |
xtuc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's worth using something like Prettier to keep a consistent styling.
| @@ -0,0 +1,110 @@ | |||
| #!/usr/bin/env node | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this file? Did you write it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, in-lining the node code as in hello-world.sh would be a bit too much with all the imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use it for emcc generated code as well, thus the demangle and strange imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes no sense here, so I'll remove the clutter
|
Prettier now. do we have custom settings or are the default settings fine? |
examples/hello-assembly/test.sh
Outdated
| binary = require('fs').readFileSync('test.wasm');\ | ||
| module = new WebAssembly.Module(binary);\ | ||
| imports={console:{log_char: c => process.stdout.write(String.fromCodePoint(c))}};\ | ||
| instance= new WebAssembly.Instance(module,imports)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and could you please split this in another js file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed hello-assembly altogether. two examples are enough
|
Sorry for coming back to this so late, but I am not quite content with the bash files necessary to run this. In general I think that the examples we have at this point have a more portable view on things and that the "Empty AssemblyScript project" template in WebAssembly Studio / the wiki pages might already cover a minimal setup sufficiently. Closing for now, but thanks for your efforts! |
Bumps [assemblyscript](https://github.com/AssemblyScript/assemblyscript) from 0.13.4 to 0.13.5. - [Release notes](https://github.com/AssemblyScript/assemblyscript/releases) - [Commits](AssemblyScript/assemblyscript@v0.13.4...v0.13.5) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
If you allow I will also simplify wiki.
https://github.com/AssemblyScript/assemblyscript/wiki/Hello-World