this post was submitted on 26 Feb 2024
257 points (96.4% liked)

Programming

17668 readers
145 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 2 years ago
MODERATORS
 

On the one side I really like c and c++ because they’re fun and have great performance; they don’t feel like your fighting the language and let me feel sort of creative in the way I do things(compared with something like Rust or Swift).

On the other hand, when weighing one’s feelings against the common good, I guess it’s not really a contest. Plus I suspect a lot of my annoyance with languages like rust stems from not being as familiar with the paradigm. What do you all think?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 27 points 10 months ago (4 children)

Rust does memory-safety in the most manual way possible

The most manual way is what C does, which is requiring the programmer to check memory safety by themselves.😛

Also will say that outside of some corner cases, Rust is really not that harder than Java or Python. Even in the relatively rare cases that you run into lifetimes, you can usually clone your data (not ideal for performance usually but hey its what the GC language would often do anyway). And reliability is far better in Rust as well so you save a lot of time debugging. Compiles = it works most of the time.

[–] [email protected] 22 points 10 months ago

C# dev with reasonable experience with java, python, and rust:

Rust is harder

[–] [email protected] 18 points 10 months ago* (last edited 10 months ago) (1 children)

The most manual way is what C does, which is requiring the programmer to check memory safety by themselves.😛

The difference is, Rust will throw a tantrum if you do things in an unsafe way. C/C++ won't even check. It'll just chug along.

Rust is really not that harder than Java or Python.

As someone who's done all three, the fuck it isn't.

If you are familiar with C/C++ best practices to any operational level, those things will translate over to Rust quite nicely. If not, that learning curve is going to be fucking ridiculous with all the new concepts you have to juggle that you just don't with either Java or Python.

[–] [email protected] 0 points 9 months ago (1 children)

I haven't been able to compile a single C/C++ program (even bought a C++ book!) Learned to write normal programs in rust (even with simple lifetime annotations!) In 1-2 months. I just knew python and the basic knowledge of 1st year university.

It's not that hard.

Just reading through the rust book (a week, maybe? I don't remember how much time it took) will make you able to confidently write a simple CLI program.

[–] [email protected] 3 points 9 months ago* (last edited 9 months ago) (1 children)

Just reading through the rust book (a week, maybe? I don’t remember how much time it took) will make you able to confidently write a simple CLI program.

You can do the same in Java or especially Python from zero much, much quicker.

Also you can learn to go beyond simple CLI programs in those languages much quicker, because you don't have to worry about memory management.

[–] [email protected] 1 points 9 months ago

I'm not saying that java or python are harder, of course they aren't. I'm just saying that it's not as hard as people seem to think. What is 1 week of commitment to learn a new language? Of course it depends on what there is to offer.

I think the benefits of rust far outweigh it's drawbacks (including the learning time).

[–] [email protected] 16 points 10 months ago* (last edited 10 months ago) (1 children)

I like Rust a lot, philosophically and functionally... but it is WAY harder. Undeniably very hard.

Just try and do anything with, say, a linked list. It's mind-boggling how hard it is to make basic things work without just cloning tons of values, using obnoxious patterns like .as_mut(), or having incredibly careful and deliberate patterns of take-ing values, Not to mention the endless use of shit like Boxes that just generates frustrating boilerplate.

I still think it's a good language and valuable to learn/use, and it's incredibly easy to create performant applications in it once you mastered the basics, but christ.

[–] [email protected] -1 points 10 months ago* (last edited 10 months ago) (1 children)

It's mind-boggling how hard it is to make basic things work

It's mind-boggling how broken basic things are.

[–] [email protected] 3 points 10 months ago

I have not encountered anything broken, aside from maybe binary app docstring stuff (e.g., automated example testing).

On the contrary, everything seems precise, reliable, and trustworthy. That's the thing to really like about Rust -- you can be pretty much fearless in it. It's just difficult. I die a bit in time any time I have a return type that looks like Box Result, CustomError>> or some shit . Honestly, the worst thing about Rust is probably that you have to manually specify heap vs stack when the compiler could easily make those determinations itself 99% of the time based on whether something is sized.

[–] [email protected] 12 points 10 months ago* (last edited 10 months ago)

Software engineer for almost two decades at this point, programming off and on since a kid in the late '80s: Rust is harder. It did seem to get better between versions and maybe it's easier now, but definitely harder than a lot of what I've worked in (which ranges Perl, PHP, C, C++, C#, Java, Groovy/Grails, Rust, js, typescript, various flavors of BASIC, and Go (and probably more I'm forgetting now but didn't work with much; I'm excluding bash/batch, DB stored procedures (though I worked on a billing system written almost entirely in them), etc.)

That said, I don't think it's a bad thing and of course working in something makes you faster at it, but I do think it's harder, especially when first learning about (and fighting with) the borrow checker, dealing with lifetimes, etc.

The availability of libraries, frameworks, tools, and documentation can also have a big impact on how long it takes to make something.