Skip to content
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

WASM support (try it out website) #13

Open
mjarkk opened this issue Jul 14, 2020 · 5 comments
Open

WASM support (try it out website) #13

mjarkk opened this issue Jul 14, 2020 · 5 comments
Labels
discussion Just some public thinking

Comments

@mjarkk
Copy link
Member

mjarkk commented Jul 14, 2020

As we getting to a v0.1.0 release it might be worth it to have a site where users can try out the language.
Like the Go Playground or the Rust Playground.

Rust projects can be compiled into WASM (web assembly) binaries so we could create a website where users can tryout our language and see if they like it without installing it.
I think it would be amazing if someone could just write some code and see in real time (if possible) the compiled output.
We could even add debug information if we want to.

@mjarkk mjarkk added the discussion Just some public thinking label Jul 14, 2020
@TheOtterlord
Copy link
Contributor

I could probably build this it I learn how WASM works. This would be brilliant as it would give users a way to test it out and maybe even learn the language (we could add tutorials).

After a quick look at the docs, we may need to create a second repository for talpa-wasm. I could start building the front end, but I think that Talpa needs to be closer to a v0.1.0 before we optimise for WASM.

@mjarkk
Copy link
Member Author

mjarkk commented Jul 16, 2020

Just thought about this and there are more than 1 use cases for this,
For example we can run show documentation previews directly in the browser.
Or even more awesome for language-talpa we can add language features like go-to definitions and showing suggestions 🤯 without having a language server the user needs to install!!

Oh and this way we can provide the compiler via a npm package so you can just do npm i -g talpa.
Not that i would like to have a slower version of the same compiler but hey it's possible using WASM.

But also now i'm thinking of it it's kinda ironic we use WASM while this language provides a way to compile into native code. But in our case this is for good reasons :)

@TheOtterlord
Copy link
Contributor

I'm not quite sure how language-talpa can be implemented in this way. I don't know how Atom and VS Code implemented it.

I'm not sure if NPM would be the best way to publish it. Although I must admit I've never published a tool like this. I'm not quite sure how you normally publish a command line tool binary (like a compiler).

@mjarkk
Copy link
Member Author

mjarkk commented Jul 16, 2020

I'm not quite sure how language-talpa can be implemented in this way. I don't know how Atom and VS Code implemented it.

Once we have a wasm file we can just load the bytes of it into vscode and execute it directly if it supports executing wasm files or via a polyfill.
There seem to be some support issues in vscode for wasm files but there are some alternative ways it can be imported seems like.

For how the contents of the wasm file i think it should contain the contents of the compiler folder.
And the compiler should have options to only execute stage 1 with limitations like limiting imports or try to continue when errors apair.

I'm not sure if NPM would be the best way to publish it

Totally true, it's essentially just an alternative to creates.io but talpa will be way slower, you will have the overhead of spawning javascript to execute the wasm and threads support is still a bit shitty.
Not great at all but it's just an option.

@TheOtterlord
Copy link
Contributor

This could help us if we do publish to NPM: Publishing a Rust binary on npm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Just some public thinking
Projects
None yet
Development

No branches or pull requests

2 participants