lainchan / λ
Should I start using Rust?
n.5111815 · 2023-12-16 08:42
Will it really replace C++ and C#? Is it better to start programming with it?(USER WAS WARNED FOR THIS POST, You should always elaborate on your opinions rather than just spilling the soykaf.)
typedef · 2023-12-16 12:00
>>37934
>Will it really replace C++ and C#?
As likely as any language will replace C. Which is very unlikely as those languages have an enormous momentum by now.
I would learn it since it forces you to think about lifetimes, which is applicable to any language. The move semantics are also much more sensible than in C++.
Whether you continue using it after is up to you. Personally I still use it a lot since the compiler can catch a lot of mistakes before you run the program. Pattern matching is also very nice.
word · 2023-12-16 14:31
>Will it really replace C++ and C#?
No
Use rust if you want to. Unless you're doing something crypto related it's very unlikely you'll get paid for it.
Faye Valentine · 2023-12-16 14:54
>>37934
C# will only be replaced by a MSFT internally developed tool, and as of right now there doesnt seem to be any contendor.
you have F# for the pretenious, VB.NET for the young and or disabled and C# for the masses.
Nemissa · 2023-12-16 14:56
We already have a rust thread. Why didn't you put this no-content question there? Your post is bad and you should feel bad.
Tequila · 2023-12-20 12:52
>>37944
That one hit the reply limit.
Technician · 2024-04-18 10:39
>>37934
Rust is in line with C++
Zig is in line with C
I remember being REALLY frustrated with Rust at first (lol skill issue on my part). It was really hard changing my mindset from C-like languages to Rust, especially with the concept of ownership (IIRC). I gave up. Might try it again idk.
Hagbard Celine · 2024-04-18 22:40
>>38886
But who will think of the webshitters (me) when they have to wrangle the borrow checker in addition to their wagie or contract jobs? Though I wonder where WASM will come into play in this more often in the future. There is already a couple UI frameworks which compile both native and into the WASI VM but I hope there's gonna be something more smooth brain appropriate that I can get arsed to learn to the extent I need in order to work in it proficiently.
But I agree on the C++ part. While C might get contested by Zig like Kotlin does Java, C++ on the other hand is C++. If you want to use C++ you gonna use C++ and not Rust while Rust has its own use cases that usually revolve around solidifying existing code that won't change much.
As for C#, I still see it as Microsoft's attempt to get those JVM specialized devs and wall them in their eco system of dot crap products. And anybody who didn't want that would just stay with Java/Kotlin as both tool and job. Unless you have to work on some game in Unity and don't want to get into Mono. That has and will remain the case. But I do see C# and Unity both losing ground to Unreal and Godot. And Kotlin being generally a nice to use language which may even get a transpiler to C# if there already isn't one. Just so M$ can lure more people back in like they tried with the support of Android apps on their WinPhone platform before that ultimately died off.
monoe · 2024-04-19 03:16
i like rust, learned it years and found many of it's features to be rather elegant.
do i still use rust? no, but i keep up with it as it has a great influence on my programming style
should you learn it? yes. will it replace c/c++? no, not in the next few decades, and probably never
JARGON · 2024-04-19 18:16
>>37942
Crypto is supposed to be done in assembly since it's the only language giving fine-enough control to mitigate side-channel attacks. Rust's only market thus far is high-performance web back-end.
Case · 2024-05-22 07:23
>>38885
> Zig
I really do like Zig, it seems like a language developed by someone who really knows what they are talking about w/r/t the needs of programmers. The fact that the compiler can also be used to compile C means that there's a convenient backdoor for it to sneak its way into widespread use.
clutch · 2024-05-26 18:17
>>37934
my company is trying to go to rust after years of C++. It's very slow going... Management trying to shoehorn it down everyone's throats for... reasons. Good-bye code re-use, hello same old truncated development timeline but now you have to re-write C++ code in rust on top of the new functionality you need to implement. Meh.
Shogun · 2024-05-26 18:34
>>38894
What? Most cryptographic primitive libraries are either written in C or C++, some in Java. Writing everything in assembly doesn't give any substantial advantage for mitigating side-channel attacks, since you're still dealing with a mostly-unknown microarchitecture that does branch prediction etc. Actual mitigations of side-channel attacks involve specialized algorithms, stack zeroization (which rust supports very well through the 'zeroize' library), disabling certain optimization passes, and extensive testing. The only reason to write assembly is because you need that last 1% performance boost.
Bobby Newmark · 2024-06-02 12:55
How can I do 4-bit arithmetic in an idiomatic way? Rn I'm defining a subtype of u8 and writing my own methods for add/subtract etc. Is there a better way?
Chani · 2024-06-04 00:31
>>39277
There is a library that does this stuff for you.
https://lib.rs/crates/ruint
For signed numbers all you need to do is slightly modify the less-than and multiplication operations.
Davis · 2024-06-04 12:18
I like it and want to use it but everything has such weak libraries that using it feels like forcing myself to reinvent the wheel and take years to do something that would take a month in other languages. I kept thinking id just wait a few years and this would change but it doesnt.
Cutter · 2025-02-21 20:09
>>39202
At least on paper most compilers do not give any constant-time guarantees and are free to insert branches wherever they like.
https://blog.cr.yp.to/20240803-clang.html
In practice, mainstream compilers are usually fairly conservative with inserting branches and it's sufficient to be aware of common patterns and inspecting the generated assembly, hence why it's fine to write crypto code in a higher-level language.
Still, there is a need for at least compiler hints that a certain piece of code should be constant-time.
Mentioned in the link are languages designed specifically for writing cryptographic code, though I'm not aware of mainstream use.
>Writing everything in assembly doesn't give any substantial advantage for mitigating side-channel attacks, since you're still dealing with a mostly-unknown microarchitecture that does branch prediction etc.
I want to emphasize this in light of data-dependent leaks thanks to Apple being fuarrrkwits: https://gofetch.fail/
(Also, I'm certain the original commenter was talking about cryptocurrency specifically, but w/e)
BloodCat · 2025-02-23 02:42
>>39296
Same, learned Rust, built a simple web server in it, and never used it since, forgot most of it by now. I can just use C++. The language itself is not bad, but it really does feel like reinventing the wheel.