5
Xoka
3y

Anybody started learning rust? Care to share some thoughts or inspirations?

Comments
  • 4
  • 7
    Expect to hate the language for the first few weeks, happens to everyone. After that it's a pleasure to use
  • 3
    I started and I stopped after a month. I encountered generics syntax, macros and unsafe clauses.

    As the language is nice at the beginning, when you want to make simple stuff. The compiler is nice. The traits are nice.
    Syntax is average at the beginning. But then if you want to use some libraries and do something more advanced.

    The disk size and dependencies are not nice.

    Pretty much every library mangle code with macros, unsafe operators and generics so the code is unreadable for me.

    Some people compare rust to python and that is offensive cause I’d rather compare it to perl and I don’t like perl.

    It’s all because they wanted to gather c/c++ developers around the new “cool” language.

    Maybe unpopular opinion but c++ was easier to use and debug than rust for me.
  • 5
    @vane That's not true at all. C++ is easier to learn but hard to master (and use safely!), Rust is hard to learn but way easier to effectively use

    You probably hit exactly the road block like everyone else. I did too and I hated the language. But after you grokked it it's amazing

    That libraries are riddled with complex macros and unsafe blocks is a complete lie though. That's not the case at all except for extremely low level libraries or thin ffi wrappers (which are unsafe by nature)
  • 4
    @12bitfloat modern c++ compiler is safer and when you use low level language you should be aware about consequences. It doesn’t matter what low level language you will chose. Sooner or later you will fall and hit the ground hard.

    Most of libraries use unsafe / macros and/or wrappers cause the language is fairly new.
  • 3
    @vane C++ is way safer now than ever but still not memory safe. And memory safe Rust compared to memory safe C++ code is night and day in terseness and boilerplate
  • 3
    @12bitfloat that’s why instead of creating another great language we should put more effort to educate people and improve/simplify existing things, otherwise we will end up with gazillion tools that no one understands how they work, lost knowledge and collapse of the civilization.
  • 6
    @vane I don't see how C++ can be fixed in a way so it looks like a terse, modern programming language, is fully memory safe and doesn't break backwards compatibility

    If it was possible I'm sure the guys behind C++ (which are pretty damn smart) would have already done it by now

    I mean just look at the move semantics compared to Rust. In Rust a move actually moves a value from one owner to another. In C++ it leaves a (hopefully) zero initialized object behind and the class of that object now has to be able to support a "not actually initialized" state which means more state checking ("am I actually an initialized object?") in each function.

    This is a perfect example of trying to fix the language but not quite being able to do so for a variety of reasons

    That's why we need Rust
  • 3
    @12bitfloat I think we need more educated people that don’t want to rewrite stuff over and over but produce well documented self explanatory code.

    But seeing how world works I don’t have any expectations that it would happen.

    There’s actually more chance that we will have another 10 more cool languages than we start producing something useful.
  • 5
    @vane Sometimes a breaking change is necessary and the best solution. I agree that we shouldn't invent 20 new languages to solve 5 new (or not) problems, but you can't optimize a horse carriage into a race car

    Not saying that C++ is a horse carriage but you get the idea. Plus if you get people to use Rust you will need drastically less education because it's pretty hard to misuse

    I get what you're saying but I think Rust is a worthwhile exception. That's also why I'm not the biggest fan of Nim, Zig, Cyclone, Ada, ...
    All cool languages, sure, but Rust is the first "C killer" that actually has the potential to kill anything let alone C
  • 3
    I found Rust easy to learn, and quite fun to use. You’ll get even more out of it if you brush up on your FP skills as well.
  • 3
    @12bitfloat Maybe... or maybe I’m seeing to many breaking changes everywhere.

    Well we’ll see in 17 years...
  • 2
    @vane I don't know which crates you've used, but in my experience, most do not use unsafe and most do not have outward facing macros.

    And even when using macros, those macros are much more advanced than the C preprocessor. You almost can't compare them.
  • 3
    Rust is the best language I've used so far. It fixes so many problems that even things like Java have.

    Traits are powerful. So much so that I haven't really missed OOP functionality.

    The typesystem is used extensively for correctness. This means no null, no unexpected values (if lib authors created good stuff) and very deliberate error handling.

    It's a lot and you won't get it at first. You run into a barrier and question why that barrier is there. But keep climbing! I promise, the view from up here is beautiful!
Add Comment