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.

Where Next?

Popular Frontend topics Top

justinjunodev
:rotating_light: Silly Post Alert :rotating_light: With the Coronavirus keeping the majority of us developers quarantined, how many “new...
New
AstonJ
I was watching this video by Richard Feldman (Elm core team) and he’s predicting TypeScript is going to take over the JS world: ...
New
MikhailPertsev
Finally, I am going to enhance my css skills! I have always somehow ignored this, but now I finally decided to understand animations, tr...
New
AstonJ
Just discovered AssemblyScript (our portal is here). It…“aims to make it easy to compile to WebAssembly using TypeScript, no strings att...
New
First poster: bot
hlang in 30 Seconds hlang (the h language) is a revolutionary new use of WebAssembly that enables single-paridigm programming without any...
New
KnowledgeIsPower
It seems it is going to change, currently they forked Next.JS. Now they want to stop forking it and change their project direction.
New
mtmattei
A few months ago, Uno Platform unveiled Uno Platform for Figma plugin, a plugin created to turn your high-fidelity Figma design into XAML...
New
SynergyRob
I invented a game of double Chess called Synergy Chess. I am not a coder. I hired someone to write the program. People can play online fo...
New
harwind
Why does the image in my <img> tag appear larger than its specified width within a flex container? Here’s my HTML and CSS code: HT...
New
riyajohnson
When it comes to selecting a framework for a development project, it’s crucial to make an informed decision. With so many options availab...
New

Other popular topics Top

DevotionGeo
I know that these benchmarks might not be the exact picture of real-world scenario, but still I expect a Rust web framework performing a ...
New
dasdom
No chair. I have a standing desk. This post was split into a dedicated thread from our thread about chairs :slight_smile:
New
AstonJ
Curious to know which languages and frameworks you’re all thinking about learning next :upside_down_face: Perhaps if there’s enough peop...
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
In case anyone else is wondering why Ruby 3 doesn’t show when you do asdf list-all ruby :man_facepalming: do this first: asdf plugin-upd...
New
Exadra37
Oh just spent so much time on this to discover now that RancherOS is in end of life but Rancher is refusing to mark the Github repo as su...
New
AstonJ
Saw this on TikTok of all places! :lol: Anyone heard of them before? Lite:
New
AstonJ
We’ve talked about his book briefly here but it is quickly becoming obsolete - so he’s decided to create a series of 7 podcasts, the firs...
New
PragmaticBookshelf
Author Spotlight: Peter Ullrich @PJUllrich Data is at the core of every business, but it is useless if nobody can access and analyze ...
New
AstonJ
If you’re getting errors like this: psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory ...
New
OSZAR »