AstonJ

AstonJ

Swift vs Rust for WASM/WebAssembly

Wondering if anyone has any thoughts on choosing between these two languages for WebAssembly?

I definitely want to explore wasm, and really love the idea of learning both of these, however, I can only squeeze one in right now.

Anyone have any thoughts? Which might be the easier route? Which will be more useful/fully featured/supported? etc.

Here are some pros and cons (from a personal perspective so far):

Rust

  • Can also be used with Elixir/Erlang nifs
  • Can also be used in other areas such as general web dev
  • Huge community support

Swift

  • Can be used for iOS/macOS apps
  • While can be used for other areas (such as web dev too - I get the feeling not quite as well as Rust)
  • Huge Apple support

Most Liked

SmithyTT

SmithyTT

Rust.

Swift for WebAssembly is not quite there yet…

herbert

herbert

Author of Hands-on Rust

I don’t have a lot of experience with Swift, so I can’t really comment on it. Rust works very well with web assembly (some assembly required, heh). One of the reasons I picked up Rust was that it made it easy to write tutorials and include a web-runnable version (my Roguelike Tutorial series has each example as a playable web game - e.g. https://bfnightly.bracketproductions.com/rustbook/wasm/chapter-74-darkcity/ ).

There are downsides. If you link with C libraries, chances are you have to come up with some shims to handle the bits of the C library that don’t exist in WASM-land. Also WebGL is almost but not quite compatible with regular GL - so for graphics you’ll have to tweak things a bit.

herbert

herbert

Author of Hands-on Rust

I may have messed up the link, sorry! http://bfnightly.bracketproductions.com/rustbook/ should work.

Rust is a systems language, so its harder than Python and other very high-level languages. It tries really hard to not surprise you, and once you have the basics down it’s a relatively smooth learning curve. Some things - like threads - are much easier than other languages. Other things like the borrow checker will cause a bit of head-scratching at first.

Popular Frontend topics Top

PragmaticBookshelf
WebAssembly fulfills the long-awaited promise of web technologies: fast code, type-safe at compile time, execution in the browser, on emb...
New
AstonJ
Inspired by @dbernheisel’s post here, which CSS framework do you use and why?
New
wolf4earth
I’m currently in the process of rebuilding my personal website/blog from scratch. At the moment my website is using hugo, and while I thi...
New
AstonJ
They now have a beginners course on NodeJS, following their beginners course on Javascript. I’m hoping they will do one o...
New
AstonJ
Which WebAssembly language/s interest you? I just discovered AssemblyScript (portal | thread) which looks interesting! Here are some of...
New
mrmurphy
The situation Hi there! I’m working on a live view app right now that encrypts sensitive user content (text and images) using the browser...
New
ClaudiaGiv
Hi all, I recently started working with Svelte and created a small app with SvelteKit in order to understand better the framework. I hav...
New
First poster: bot
Tailwind v2.2.10, v2.2.9 and v2.2.8 has been released. Link: Release v2.2.10 · tailwindlabs/tailwindcss · GitHub Link: Release v2.2.9...
New
First poster: AstonJ
A new Svelte blog post/announcement has been posted! Get the full details here: https://svelte.dev/blog/whats-new-in-svelte-november-2021
New
The_Exile
I am new to programming. I started reading Eloquent Javascript 3rd Edition, as the book comes highly recommended as a good place for beg...
/js
New

Other popular topics Top

Devtalk
Hello Devtalk World! Please let us know a little about who you are and where you’re from :nerd_face:
New
brentjanderson
Bought the Moonlander mechanical keyboard. Cherry Brown MX switches. Arms and wrists have been hurting enough that it’s time I did someth...
New
AstonJ
You might be thinking we should just ask who’s not using VSCode :joy: however there are some new additions in the space that might give V...
New
AstonJ
I have seen the keycaps I want - they are due for a group-buy this week but won’t be delivered until October next year!!! :rofl: The Ser...
New
PragmaticBookshelf
“A Mystical Experience” Hero’s Journey with Paolo Perrotta @nusco Ever wonder how authoring books compares to writing articles?...
New
PragmaticBookshelf
Author Spotlight Jamis Buck @jamis This month, we have the pleasure of spotlighting author Jamis Buck, who has written Mazes for Prog...
New
PragmaticBookshelf
Author Spotlight Rebecca Skinner @RebeccaSkinner Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
New
PragmaticBookshelf
Author Spotlight: Karl Stolley @karlstolley Logic! Rhetoric! Prag! Wow, what a combination. In this spotlight, we sit down with Karl ...
New
DevotionGeo
I have always used antique keyboards like Cherry MX 1800 or Cherry MX 8100 and almost always have modified the switches in some way, like...
New
First poster: bot
zig/http.zig at 7cf2cbb33ef34c1d211135f56d30fe23b6cacd42 · ziglang/zig. General-purpose programming language and toolchain for maintaini...
New