AgregoreWeb / agregore-browser

A minimal browser for the distributed web (Desktop version)
https://www.youtube.com/watch?v=TnYKvOQB0ts&list=PL7sG5SCUNyeYx8wnfMOUpsh7rM_g0w_cu&index=14
GNU Affero General Public License v3.0
741 stars 66 forks source link

Proposal Using Rust Language write #206

Closed Pantyhose-X closed 2 years ago

Pantyhose-X commented 2 years ago

Many Linux now use the Rust language to write code.If JavaScript is eliminated, all the hard work you've done will be for nothing,

Rust is an incredible powerful programming language. It is fast, compiled, without a runtime and it brings new concepts of safety to programming.

Rust is a fast, reliable, and memory-efficient programming language. It's been voted the most loved programming language six years in a row (survey). Created by Mozilla, it's now used at Facebook, Apple, Amazon, Microsoft, and Google for systems infrastructure, encryption, virtualization, and more low-level programming.

Why is Rust now being used to replace parts of the JavaScript web ecosystem like minification (Terser), transpilation (Babel), formatting (Prettier), bundling (webpack), linting (ESLint), and more?

Note: This post is also available in Chinese, Portuguese, Vietnamese, and Arabic.

What is Rust? Rust helps developers write fast software that's memory-efficient. It's a modern replacement for languages like C++ or C with a focus on code safety and concise syntax.

Rust is quite different than JavaScript. JavaScript tries to find variables or objects not in use and automatically clears them from memory. This is called Garbage Collection. The language abstracts the developer from thinking about manual memory management.

With Rust, developers have more control over memory allocation, without it being as painful as C++.

Rust uses a relatively unique memory management approach that incorporates the idea of memory “ownership”. Basically, Rust keeps track of who can read and write to memory. It knows when the program is using memory and immediately frees the memory once it is no longer needed. It enforces memory rules at compile time, making it virtually impossible to have runtime memory bugs. You do not need to manually keep track of memory. The compiler takes care of it.

Reference

RangerMauve commented 2 years ago

Hey, thank you for the writeup.

I'm all for doing stuff in rust but there's a few things blocking it:

I think once Tauri gets custom protocol support, and IPFS/Hypercore get Rust implementations (likely years away) this will be a lot more doable. 😅

Another approach I've been looking at is how Chromium was planning to integrate Rust into their build systems. Once this is settled down, I can ditch some of the Golang embeds in Agregore Mobile and embed Rust code in their C++ handlers directly.

I'm going to close this issue for now, but you can expect me to create a new one once the ecosystem gets further along to it being a viable option. 👍

Outside of that, it's a big undertaking and we would need to find time/funding to do such a rewrite.