News for hackers. Stuff that matters.
Re:Rust Language Cheat Sheet by marcus_cemes on Sunday April 25, 2021 @08:18AM (#26932158)
My experience with Rust is that it tries to squeeze every last drop of performance, but instead of relying on simplicity (C) or unsafety (C++, the reason Mozilla started it was to reduce C++ memory-related bugs), it introduces language complexity (lifetimes, "prove that your code is safe, or fallback to a runtime overhead such as Mutex") and a little-bit of runtime overhead (explicit Option<T>/enum checks). In my mind, it doesn't play in the same league as high(er)-level garbage collected languages. It was made for robust low-level applications, which is why it's being considered for the Linux kernel, and not Lisp.

Concatenating strings in a GC language is easy, you just "+" them together, the cleanup will happen eventually. Concatenating in low-level languages means you have to think about the memory allocation(s) taking place, and the format("{}{}") is a lot more powerful for anything more than just adding two strings. What if you want to prepend "https://"? In GC languages, this might be an extra string being allocated and discarded, in Rust, it's a constant hard-coded into the binary. It just happens that the language has attracted a lot of people who are used to higher-level abstractions due to it's relatively pleasant syntax, type system and abstractions, ecosystem and perfomance.

Re:Rust Language Cheat Sheet by otabdeveloper4 on Sunday April 25, 2021 @08:44AM (#26932286)
C++ is also 'just "+" them together', and it's not unsafe.
Re:Rust Language Cheat Sheet by oijk on Sunday April 25, 2021 @08:52AM (#26932322)
Re:Rust Language Cheat Sheet by otabdeveloper4 on Sunday April 25, 2021 @09:36AM (#26932592)
string_view is a new feature designed on purpose to be unsafe.
Re:Rust Language Cheat Sheet by pjmlp on Sunday April 25, 2021 @11:56AM (#26933689)
The idea was to copy slices model from memory safe languages, naturally being C++ with C's influence regarding performance trumps safety, string_view couldn't be made to be as safe as the idea they were copying from.

Another example is span, while C#'s Span and Microsoft's gsl::span do bounds checking, ISO C++17 span naturally leaves it to the developer's responsibility.

Re:Rust Language Cheat Sheet by otabdeveloper4 on Monday April 26, 2021 @04:15AM (#26940410)
> The idea was to copy slices model from memory safe languages

No, the idea was to make a simple one-to-one wrapper for the "char, char" pairs programmers were already using all over the place, nothing more.