Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API

From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
D-4got10-01205624d@whimsical > 'Rust is for men who like men.'
Backdoor sex joke, eh? If they exercise proper hygiene, they won't get dirty.
/jk -
12bitfloat1066024dYou can! You just have to learn the damn language
What part of the `?` operator is not concise? It's one character. Don't overengineer your errors for no reason and just use anyhow
I swear you're creating so many problems for yourself that don't have to exist -
Lensflare2034824d@jestdotty you could look it up yourself https://en.m.wikipedia.org/wiki/...
but ok…
imperative means that you describe the steps how to perform a task, one after another.
It‘s kind of the opposite of declarative programming, where you describe what you want as the result. -
12bitfloat1066024d@jestdotty let x = y.map_err(|e| *can touch error*)?;
or better yet with anyhow just
let x = y?;
if you don't need any special error handling -
Lensflare2034824d@jestdotty I just love correcting people lol.
Funny how people get aggressive defensive about that. -
12bitfloat1066024d@jestdotty Yeah, to be fair that exact pattern has also frustrated me in Rust
But if you just return Result<(), anyhow::Error> from your main function then `let x = y.context("oh noes!")?;` just works
If you really don't want Results (or cant) you could also write a quick macro to avoid the double indentations of a match: https://play.rust-lang.org//...
Rust is so flexible, you can always find a solution -
Lensflare2034824d@jestdotty everything that I have to say you aren’t able to comprehend anyway. That’s what I learned from our little exchanges so far.
Anyway, gimme my XP points already :] -
12bitfloat1066024d@jestdotty Check out the Rust playground link I posted, I didn't write that code just for fun
Honestly makes me think you don't even try to understand my comments and then you cry about how rust is bad even after I showed you specific solutions to you problem
>.> -
jestdotty646124d@12bitfloat oh whoops I automatically adblock links in my mind and didn't even notice it
-
12bitfloat1066024d@jestdotty Yeah but you see how this simple macro made the "if error log and exit" thing so much nicer? Its about pragmatism! A little bit of complexity can make your life a whole lot easier sometimes
-
12bitfloat1066023d@jestdotty Yeah but no kinda
I almost never use macros. What I'm saying is: Do what makes the most sense
A lot of what you are complaining about is easily solved with a function or macro. Why is it a problem if it can be solved that easily?
all the solutions in rust are always subpar
and it's not even the ownership stuff it's the syntax like with errors with stuff
you just can't be concise so don't even try it
write everything out imperative
rant