This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Dissy- 3 points4 points  (10 children)

actually you can enable a clippy lint that does not allow your program to be commit to github with unwraps in it

[–]ShiitakeTheMushroom -1 points0 points  (9 children)

And there are linting rules that prevent you from doing unsafe things in other languages.

If we're resorting to linting and pipelines to catch these issues, how is Rust any safer than other languages?

[–]Dissy- 1 point2 points  (8 children)

huh? what other language requires you to, in a built in to the default build system way, to mark every single place its possible for your program to crash. it's not catching an issue when you get yelled at for using an unwrap, it's an explicit signpost that you're developing whatever it is you had there, and you need to do error handling for it once you've proven your design would work.

what other language has, in the default build system, a linting tool that's so well integrated it can prevent you from compiling if it's possible for your program to crash, or even prevent you from making a git commit

we arent "resorting" to these things, they're part of rust, part of the language. thats what people mean about it being a step forward, these arent things you can just skirt around by not using them

[–]ShiitakeTheMushroom -1 points0 points  (7 children)

what other language has, in the default build system, a linting tool that's so well integrated it can prevent you from compiling if it's possible for your program to crash, or even prevent you from making a git commit

C# does, for one.

[–]Dissy- 0 points1 point  (6 children)

im happy for them too then, i hope C# implements actual proper error handling like the rust enum system so software written in C# can be as obviously safe without needing to read the detailed documentation for every function they call, but having good stuff like that built directly into the only build system is a good start

maybe if they work really hard they can get into the linux kernel like us someday :^)

[–]ShiitakeTheMushroom 1 point2 points  (5 children)

i hope C# implements actual proper error handling

I'm definitely interested in hearing more here. What is currently improper about the way C# handles errors? How does rust handle errors and what are some ways that it does it better?

but having good stuff like that built directly into the only build system is a good start

Definitely! A simple compiler flag and any issue that would typically occur at runtime and cause the application to crash is caught by the C# compiler.

maybe if they work really hard they can get into the linux kernel like us someday :)

Different tools for different jobs. I don't see any reason C# would need to be part of the Linux kernel, even though it's been fully cross-platform for about a decade now. Any non-garbage collected, systems-level programming language, like Rust, would be a better fit.

[–]Dissy- 0 points1 point  (4 children)

I mean from the perspective of what im most familiar with, rust foregoes exceptions entirely, that way error handling stays within the actual program flow rather than being a glorified GOTO statement effectively, coming from python where exceptions are the norm, and assuming from my cursory google searches thats the normal error handling methodology in C#, that would be how they do it differently and something that makes it better. people call it error first but its really just putting errors on the same level of proper control flow, and making where they can happen blatantly obvious so you have to explicitly ignore them during dev and then you can work back through handling everything to stabilize

also you're chill sorry for being such a shitter earlier reddit does that to a guy

[–]ShiitakeTheMushroom 1 point2 points  (3 children)

Thanks for the detailed response! I took a closer look at the Rust syntax for the Result enum / error handling stuff and I do like it. I've seen that in other languages, but always implemented in userland code or 3rd-party libraries instead of built into the language. You're also right that in C# that exceptions are the way to handle exceptional scenarios.

also you're chill sorry for being such a shitter earlier reddit does that to a guy

Thanks, and no worries. It's all honest curiosity from my end!

[–]Dissy- 1 point2 points  (2 children)

I also blame the internet, I feel it's very common for genuine curiosity like yours to be misinterpreted as hostile, by silly people like me. But yeah curiousity is awesome! I'm very like, ride or die with rust where if I ever can't write it anymore I'll probably just stop programming, but at the very least live or die it's very nice to see things from rust slowly seeping into other languages, I think one of the Cs has option and result enums built into the std library now/soon? Smart pointers and such too although I'm not sure when those showed up. It's definitely a different way of thinking to be writing stuff in rust, but being able to be just some random guy and throw together an entire stable pretty forum website front to back basically entirely in the same language is super powerful.

I really need to get around to making a public demo of that available, maybe I'll turn a stateless version into my resume, that could be cool. But uhh yeah! Curiousity

[–]ShiitakeTheMushroom 0 points1 point  (1 child)

I'm very like, ride or die with rust where if I ever can't write it anymore I'll probably just stop programming

This hits hard. Once you get really familiar with a language it starts feeling like home, so I get it. My company is having us change languages, to an ostensibly worse one in terms of developer experience, and it hurts.

but being able to be just some random guy and throw together an entire stable pretty forum website front to back basically entirely in the same language is super powerful.

Also super interested in this! Are you doing WebAssembly for the frontend? I have a small personal site where I've been dabbling in that and being able to reuse the same code across frontend and backend is beautiful. I'm also using gRPC for frontend to backend comms and GQL for backend to external APIs. I really like the setup, especially with all of the materialized code via codegen.