Categories > Coding > Rust >

Is rust worth learning?

yvneEnvy

<><><<>>><<>

Posts: 306

Threads: 47

Joined: Mar, 2023

Reputation: 3

Posted

Is rust worth learning?

 

Content must be 20-8000 characters long

  • 0

Posts: 283

Threads: 48

Joined: May, 2022

Reputation: -4

Replied

@reversed_coffee, C++'s learning curve is a lot worse than Rust's.

C++ doesn't have an official C++ book, doesn't have official C++ learning exercises, and the compiler error messages and warnings differ from compiler to compiler.

Rust is a lot easier to learn because on the front page it literally tells you the top 3 official resources to learn Rust from. If you're a by example learner, there's the offical rust by example book for that, if you like reading more, there's the official rust book, you like learning from exercises? The official rustlings book.

 

What concepts exactly do you think Rust introduces that are hard to grep?

 

 

 

  • 0

https://media.discordapp.net/attachments/1044764388546068510/1051935933836050482/Signature_4.png

Posts: 2014

Threads: 198

Joined: Apr, 2021

Reputation: 16

Replied

Yes, it is worth learning. I am currently starting to learn it, and it is great.

  • 0

Random quote here...

Posts: 283

Threads: 48

Joined: May, 2022

Reputation: -4

Replied

@reversed_coffee, the match statement has a lot more power than your regular switch statement lol, maybe that's why you're having a hard time grasping it. But I don't understand how out of all things in Rust to be stuck on, match statements is what's perplexing to you, what's hard about them?

  • 0

Added

@Astronemi, "just because you can, doesn't mean you should". Rust should be used for literally every single possible case of native app development, the only thing I can see someone logically not using rust for is web development, other than that, Rust and a few specific cases, for most things, Rust should be the language.

  • 0

https://media.discordapp.net/attachments/1044764388546068510/1051935933836050482/Signature_4.png

allennova

allennova

Posts: 240

Threads: 13

Joined: Dec, 2017

Reputation: 28

Replied

@luxiferrwoo

For Linux kernel development, rust is a big maybe as compile times would drag even further on older systems, the rust compiler would have to somehow be bundled, and source based distros like gentoo can't really compile rust yet, as the rust compiler isn't default.

 

For compiling c or c++ on older systems, a distributed compiler like distcc exists, but can't be Jerry rigged to rust. You would have to make a complete rewrite and also have it support cross compiling for things like arm, PowerPC, x86 and other niche architectures.

There's some rust code in the kernel iirc, but internal mailing lists are debating on rewriting more of the mainline kernel in rust or not.

  • 0

NZXT H510i, MSI X470 & 650W PSU, 1TB Crucial MX200 SSD
Seagate 1TB HDD, EVGA RTX 3060ti
Ryzen 5 5600x, 2x16GB Corsair @3600Mhz

Posts: 15

Threads: 2

Joined: Feb, 2023

Reputation: 4

Replied

@allennova

 

I'm gonna be writing a distributed compiler for Rust, but it's currently on hold as I have a lot of LUNIR work to do.

 

@yvneEnvy

 

100%, Rust is the future and the future is now. You should learn it because it will teach you 2 key things that apply everywhere:

  1.  All code is security critical code.
  2.  Best practices are not optional.

Personally., after learning Rust, I found myself having a hard time in other languages with unhelpful compilers and weak type systems, and it took some readjusting to be able to write code in all the langauges which I needed to write code in. Rust is an incredibly empowering langauge which will open many doors for you, as it runs both at the lowest and the highest of levels. It can run on bare metal and embedded systems and also on the browser at the frontend. The crate and tooling ecosystems are unmatched, and the community is extremely helpful. Despite all the talk of the learning curve, I think it's not that bad now with the presence of the new experimental interactive Rust book, the abundance of visuals serves to flatten the curve significantly comparing the mainly text-based format of the standard book (do keep in mind there are still things that need to be ironed out in this version of the book, and you should report any bugs or issues you encounter on their GitHub issues, or propose a fix via a pull request). 

 

That's just an overview, so let's get technical:

  • Rust uses OBRM, Ownership Based Resource Management, where any datum has a singular "owner", this datum is only removed "dropped" when the owner goes out of scope.
  • References have strict aliasing rules, only 1 reference that can modify the underlying data xor many references that can only read the underlying data can exist at one time, this solves a lot of problems.
  • Highly advanced (still not as advanced as it could potentially be) type system which allows the creation of ergonomic APIs and powerful static analysis of programs.
  • A mix of the familiar object-oriented principles with procedural and functional paradigms, resulting in concise and intuitive code which is open to growth and modification. 
  • "Fearless concurrency" via the Send and Sync traits, along with fine grained control over atomics and other synchronisation primitives.
  • Full and easy compatibility with existing C.
  • Powerful compile time features with declarative and procedural macros (those can access the internet too).
  • Expression-based syntax simplifies many tasks and reduces the cases where you need to bend over backwards to acheive certain dances of control flow.
  • A small and useful standard library with mostly well designed APIs and readable source that helps in learning and understanding how things work. 
  • Safe code and unsafe code is distinct, and certain operations are restricted to unsafe code only, which helps in identifying when problems might lie by eliminating all code outside of unsafe blocks and code that does not invoke unsafe blocks.
  • Strong async-await support which allows for automated concurrency of tasks.
  • Drop-in concurrency with the rayon crate which allows for easy parallelisation of iterative tasks.
  • Clean inline assembly, access to SIMD versions of primitives.
  • RAII as a rule.
  • No nulls and no exceptions.
  • Fine-grained control over panicking.
  • Easy and forced error handling, your code won't compile if you do nothing about an error.
  • Choice between static and dynamic polymorphism made clear.
  • Documentation is generated for all crates, and documenting is easy using doc comments which generates HTML on docs.rs.
  • Extremely high performance as a bonus.
  • And more which I'm forgetting.
  • 1

Rust is the future and the future is now

allennova

allennova

Posts: 240

Threads: 13

Joined: Dec, 2017

Reputation: 28

Replied

@dyslexicsteak

 

Someone is already making a reimplementation for distcc, but in rust. Last commit was 3 weeks ago.

 

https://github.com/garentyler/distrustc

  • 0

NZXT H510i, MSI X470 & 650W PSU, 1TB Crucial MX200 SSD
Seagate 1TB HDD, EVGA RTX 3060ti
Ryzen 5 5600x, 2x16GB Corsair @3600Mhz

Posts: 15

Threads: 2

Joined: Feb, 2023

Reputation: 4

Replied

@allennova

 

Oh that's cool, I'll take a look at it every now and then, if it's satisfactory by the time that I finish up my giant pile of LUNIR work then I'll contribute, else I'll make my own. Thanks for telling me.

  • 0

Rust is the future and the future is now

Posts: 1

Threads: 0

Joined: Apr, 2023

Reputation: 0

Replied

Believe me, rust is the future.  Try to learn it if you can

  • 0

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )