After coding stuff for IC with Rust for over 5 years and trying to switch to Motoko during last couple of days, here are my thoughts so far.
If you absolutely need performance (computation/storage heavy flow: cryptography, data processing, compression, storage, etc), go with Rust or go even off-chain.
If you want (and know how) to control every single aspect of the execution and squize every last drop of the infrastructure given to you, go with Rust.
But get ready for a lot of code. Rust is a very verbose language - you have to explain a lot to the compiler in exchange for that performance. Also, while Rustâs ecosystem (with absolute majority of crates compiling to wasm without any problem) is orders of magnitude larger than Motokoâs, there is actually very few crates which would help you with IC-related programming. Most of the crates are built by Dfinity, with their own priorities and trade-offs. If your dapp is so unique and demanding that you decided to go with Rust, most probably you would need to implement a lot of low-level stuff by yourself.
For everything else, just stick with Motoko and help it mature. With EOP released recently it is actually easier to code ready-for-battle stuff with it. Stable memory freedom was the only thing that kept me stuck with Rust.
The docs are good, but they could use some simplification. They start with inner-workings and only make sense if you read them completely (a sign that they were written by a deeply technical person). For example, âObjects Classesâ section starts with In Motoko, an object encapsulates state, and an object "class" is a package of two entities that share a common name.
A package? Two entities? What?
When you read the section carefully and completely you get that the author is trying to say, that there are no âclassesâ or OOP in the usual meaning and Motokoâs classes are just a sprinkle of sugar on top of objects and functions, but this is not what I want at my first steps with Motoko. I tried laguages already, I know that stuff can be implemented in f-d up ways under-the-hood, this is not useful to me yet. Now I want to know, if this abstraction would allow me to achieve what I want to achieve or I should use something else.
And ideal version of this section for me would be something like: âClasses in Motoko are not real classes like in other OOP languages, but they serve the same purpose. You use classes when you want to be able to create multiple instances of objects of the same shape. For example, here is a human
class: ⌠There are no âthisâ or âselfâ keywords in Motoko, because of the inner-workings, but here is how you can hack yourself one to make it feel more familiar: âŚâ.
The âcanonâ code style formatting is beyond good and evil. Donât know what is my problem with it exactly - it looks and feels too âengineeredâ. The websiteâs main Motoko section says âJavascript-like languageâ, but you wonât find similar formatting preset in prettier or any other opinionated tool. For some reason, while it is completely possible to write code that is almost identical to Typescript, the formating there makes everything to prevent that.
Other than that Motoko feels like freedom after Rust. I have a tiny library in Rust called ic-e8s (helps with fixed decimal point math, like division and multiplication and conversion between decimal points). In Rust it takes 450 loc, while in Motoko it is only 115 loc. It is not as pretty in practice (could use some operator overloading and macros/const generics) but the implementation itself is much more readable.
The project Iâm working on right now has a lot of cross-referencing and stuff that is usually super-verbose in Rust (and not quite possible to do in stable memory right now), but here it all just maps from my Typescript prototype almost 1-to-1.
My journey with Motoko has just started. Going to keep you posted if I have something interesting to tell.