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

Consider Second Language for Wasm contracts #74

Open
ethanfrey opened this issue Dec 11, 2019 · 3 comments
Open

Consider Second Language for Wasm contracts #74

ethanfrey opened this issue Dec 11, 2019 · 3 comments

Comments

@ethanfrey
Copy link
Member

@ethanfrey ethanfrey commented Dec 11, 2019

Rust has great support for wasm and I do like it, but it also has a steep learning curve and may not be ideal to get most number of developers building on cosmwasm. Since the actual bindings are not so big, once they stabilize, I would be interested in adding support for writing contracts in another language. This would require both the basic libraries (what cosmwasm provides) as well as a tutorial. And ideally some bindings to do integration tests in the same language (ffi into cosmwasm-vm).

Time for investigation is now. Time for implementation is when cosmwasm api is stabilized (at or nearing a 1.0 release)

There is a nice list of wasm-suppporting languages. Many are "unstable but usable". I would prefer to take one with stable wasm support, but this really ends up with C/C++, Rust, AssemblyScript or Go if we stick to mainstream languages with stable support. We may also consider some nice ones with unstable support.


Stable

AssemblyScript A subset of typescript, meant to introduce web developers to wasm. Near Protocol is using this as the main language for their wasm smart contracts (along side rust), chosen for ease-of-use by devs.

Go There is a custom llvm backend for go, branded "tinygo" which allows you to compile go programs to wasm. While go is more verbose than the other languages on this list, it is also known to cosmos SDK developers.


Unstable

Kotlin Nice ergonomic language, known by many android developers. Kotlin/Native adds wasm32 support, but it is not 1.0 yet and seems like progress is slowing down (from forum comment)

Swift a very nice language, used by iOS developers everywhere, but wasm support is just starting:

@jackrabbithanna

This comment has been minimized.

Copy link

@jackrabbithanna jackrabbithanna commented Dec 12, 2019

There's lots of PHP/Javascript developers in the world, including me :)

@ethanfrey

This comment has been minimized.

Copy link
Member Author

@ethanfrey ethanfrey commented Dec 12, 2019

@jackrabbithanna Please take a look at the list of wasm-suppporting languages. The languages that can be compiled down to web assembly.

php and javascript are poor candidates as they have no type info, needing an interpreter. Assembly script is an even stronger-typed subset of TypeScript, which can compile down to wasm. This is the closest you can get to javascript I believe, and it is quite stable actually. It has the same syntax as javascript, just adding type annotations.

Can you take a look at the above link and let me know if this would be a good option for you? (If so, please add a 👍 for AssemblyScript)

@jackrabbithanna

This comment has been minimized.

Copy link

@jackrabbithanna jackrabbithanna commented Dec 12, 2019

I was doing some research after I made that comment (should have done before). I did see AssemblyScript in a video, and yeah looks very similar to Javascript, so +1 for AssemblyScript.

But do what's best for project not because I want it, I can learn new things. Go seems to make sense because Cosmos SDK in Go as well. I'm excited about the Cosmos toolset that is being built. I did get the Rust toolset setup and the test contract to compile. Definitely some learning curve for me with development in Rust. Modern Symfony/Drupal dev in PHP is full on OO, but no pointers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.