this post was submitted on 14 Aug 2023
36 points (90.9% liked)

Rust

6117 readers
4 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

[email protected]

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 2 years ago
MODERATORS
top 13 comments
sorted by: hot top controversial new old
[–] [email protected] 7 points 1 year ago (2 children)

High level folks complain it takes too long to code in and is hard to understand the borrow checker. Low level folks complain it takes too long to code in and is hard to understand the borrow checker. Honestly though the borrow checker is a great compromise to idiot proof memory leak prevention, and the C folks can just throw in unsafe when they want start slinging pointers and manual heap management. The macro system alone is so good I don't think it's fair to appraise the language until you've written a dozen macros

[–] [email protected] 4 points 1 year ago* (last edited 1 year ago)

@MakeAvoy @snaggen Have you ever written a recursive macro with multiple variadic arguments, my friend? It is so cursed, yet so good when it works (if it works).

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago)

I'd argue the macros are quite bad:

  • Declarative macros are hard to read, same level as regex
  • Procedural macros require to write a new crate with a ton of boilerplate, sometimes for stuff conceptually really simple (like hash is: apply the same function to every field, then compose the results)

I agree, though, that it's better there're here than nothing. It's just that there is to be a better solution.

[–] [email protected] 3 points 1 year ago (1 children)

Rust has gained immense popularity for its ability to help developers write robust and efficient code without sacrificing ease of use.

Rust's unique features and design principles grant it several advantages over other programming languages

I don't want praise and ads, I want honest and clear points: what good and what not so good.

[–] [email protected] 4 points 1 year ago (2 children)

Good:

  • fast
  • high-level language constructs like iterators
  • memory bugs harder to write vs C/C++
  • compiler errors are ridiculously helpful
  • borrow checker makes some hard things easier (memory management; Inter-thread communication)

Not so good:

  • you will not like the borrow checker, even as it saves you from yourself
  • executables are larger due to static linking
  • language is BIIIG
  • compilation is slow (but getting better)

Overall, I like Rust a lot. I think its reputation as a great language is well-deserved. It's not an "easy" language to use, but it prevents so many footguns... It takes me longer to get to a working prototype in Rust. But the first time it compiles successfully... it's probably right.

If I'm working on a project that needs to be fast, I'll reach for Rust over C these days.

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago)

you will not like the borrow checker, even as it saves you from yourself

I absolutely love the borrow checker. When I do stupid things, instead of me debugging segfaults in prod a week later, it goes "here dumdum, that won't work"

Rust gives me better safety than popular high level languages because it is properly typed AND C++ like performance.

In the past I'd always be forced to choose between:

  • fast development, slow runtime, big fat VM to lug around, no segfaults

  • slow development, fast runtime, no VM, segfaults

With Rust I finally get both! Fast development, fast runtime, no VM, no segfaults. It's a dream come true.

I get that there are some half-gods with 30 years of experience that can write safe and reliable C++, but I am not as smart as them nor have I 30 years to learn. And thrn again, even the best C++ developers still occasionally write memory management bugs. It's been more than a decade since I've actually been happy with a new programming language, and I love it.

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago) (2 children)

Thanks, you comment definitely makes me want to try Rust.

Could you tell me, can I use Rust as general purpose application language? Something like: create small executable app (win,unix,mac) that read some files, and do something with it, create GUI app that connects to DB and do something with it, etc?

[–] [email protected] 2 points 1 year ago

Yesbut...

Rust's GUI frameworks are all (afaik) still pretty early and a little clunky to use.

...and compiling for Windows is a little clunky.

From a purely yes/no perspective, you can absolutely use Rust for building desktop GUI apps... But I'd recommend using a different language unless your app has really tight performance requirements.

If you want to make a cross platform app with good GUI support, I'd a actually recommend checking out Godot. It's technically a game engine, but the built in scripting language (gdscript) and GUI components are really great. If gdscript is too slow for your purposes you can swap in a lot of other languages (including Rust) though C# is the best supported of these.

[–] [email protected] 1 points 1 year ago

You might like Tauri

[–] [email protected] 2 points 1 year ago (1 children)

Unfortunately GitHub Stars doesn't equal real world use in business. But we're getting there

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago) (1 children)

Be the change you want to see in the world. Rust is used at my workplace because a colleague and I lobbied for it when a project came up in which it fit.

[–] [email protected] 2 points 1 year ago

Sure, but there is a lot of effort involved with bootstrapping a new language in a larger dev organization. But we'll get there

[–] [email protected] -1 points 1 year ago

TLDR: because it's the best