[Full credit to @bastian for this idea! He mentioned the possibility in an off-handed way the other day, and it kind of blew my mind. Seems worth discussion with the rest of you!]
If you’ve looked at the Rust implementation of smart contracts on Cosmos or Solana, you’ll understand why the Flow team was pretty confident that WASM wasn’t the right solution for smart contracts generally. My thoughts on this haven’t changed at all in the intervening years; tracking ownership and access rights in Rust and Go simply is a good match for their design goals.
However!
As I see more projects looking into putting non-trivial logic in Cadence (like game logic or zero-knowledge proof checks), I think there might be value in using WASM for its raw algorithmic throughput. The same way you might import a numerical library written in C for use in Python, perhaps WASM is a great compliment to Cadence for certain workloads.
I don’t think the dev effort is extreme, either! There are a several chains (Cosmos, Polkadot, Multiverse) that use WASM and must have implementations that have some kind of execution effort metering. (I know the Ethereum community was working on this several years ago, but I haven’t heard much about it lately. Perhaps they moved on from that idea?)
And Cadence is designed to make it easy to publish “host hooks” so that Cadence code can call back into native libraries (it’s how crypto calls work from Cadence). No reworking necessary to make room for native callbacks.
The goal of this would be all about data processing and pure logic calculation. Passing Resource objects into the WASM runtime wouldn’t be safe, but a Resource object that used WASM logic to update its internal state would be very tractable. I think this could unlock a ton of performance for certain kinds of code without much disruption to the protocol.
I think an experienced Go engineer (or other systems development languages) that is new to the Flow project could reasonably take this work on with minimal support. I’m curious to get folks thoughts on this idea!