Skip to content

Conversation

@pannous
Copy link

@pannous pannous commented Mar 19, 2018

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}})"
Copy link

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?

@dcodeIO
Copy link
Member

dcodeIO commented Mar 20, 2018

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.

@pannous
Copy link
Author

pannous commented Mar 20, 2018

while https://webassembly.studio will be nice for large projects,
to get started a leaner IDE like
https://maxgraey.github.io/Assembleash/#AssemblyScript or
https://wasdk.github.io/WasmFiddle/?ttxwx
seems better suited for a hello world.

We can link to both Assembleash and webassembly.studio and keep the examples folder for people who prefer their terminal.

Pannous added 2 commits March 20, 2018 10:34
@pannous
Copy link
Author

pannous commented Mar 20, 2018

@xtuc agreed, I over-optimized for brevity, not readability. fixed

@xtuc
Copy link

xtuc commented Mar 20, 2018

What do you guys think of moving examples towards WebAssembly Studio fiddles on the long run?

Yes that's a good idea, people would get a feeling by playing with it.

@pannous
Copy link
Author

pannous commented Mar 20, 2018

WasmFiddle for AssemblyScript would be ideal IDE for starters IMHO

Pannous added 3 commits March 20, 2018 11:18
@dcodeIO
Copy link
Member

dcodeIO commented Mar 20, 2018

WasmFiddle for AssemblyScript would be ideal IDE for starters IMHO

Maybe we should provide something like this then on GitHub pages? There used to be this one (source) for the prototype for example. Or maybe try to simplify fiddles on WebAssembly Studio in this regard? Related: #37

Copy link

@xtuc xtuc left a 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
Copy link

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?

Copy link
Author

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

Copy link
Author

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

Copy link
Author

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

@pannous
Copy link
Author

pannous commented Mar 26, 2018

Prettier now. do we have custom settings or are the default settings fine?

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)"
Copy link

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?

Copy link
Author

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

@dcodeIO
Copy link
Member

dcodeIO commented May 22, 2018

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!

@dcodeIO dcodeIO closed this May 22, 2018
radu-matei pushed a commit to radu-matei/assemblyscript that referenced this pull request Oct 13, 2020
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants