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
-
@whimsical > 'Rust is for men who like men.'
Backdoor sex joke, eh? If they exercise proper hygiene, they won't get dirty.
/jk -
You 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 -
@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. -
@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 -
@Lensflare well you're the one trying to be snob of knowledge here, so, whose fault is that?!
-
@jestdotty I just love correcting people lol.
Funny how people get aggressive defensive about that. -
@Lensflare I don't see a correction... you've said nothing lol
but so be it. think you're special. I much rather you had something to say but it seems you're on another quest -
@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 -
@12bitfloat yeah the solution is a match but uegh matches everywhere with that redundant Ok case line
I'm nitpicking
I must reduce my standards
I'm too used to making javascript look like Haskell
I must suffer more pain until I become better -
@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 :] -
@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
>.> -
@12bitfloat oh whoops I automatically adblock links in my mind and didn't even notice it
-
@12bitfloat right, cuz you mentioned macros
not too sure of use cases of macros. soon rust will look like lisp I guess?
but yeah I am being fatalistic and savage. that's kind of how I move in -
@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
-
@12bitfloat but then it all looks like a macro call... you can't skim the code's structures to know what's going on lol
-
@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