Details
-
AboutAAAAAAAAAAAAAAAAAAA
-
SkillsRust and other things
-
Locationhere
-
Website
Joined devRant on 12/8/2018
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
-
Oh
Oh no... -
@jestdotty Okay how do you not understand this 😭
You pass things up the call stack
No global variables
If you want your function to have the data of your program you pass it via a reference -
@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? -
@jestdotty Global vars bad, local vars that you borrow to functions good
At least when doing Rust -
@jestdotty slotmaps! Instead of each nodes doing the logic on their own, have a function which evaluates the logic *for* a node. That function gets passed &mut Context, which contains all the slotmaps for different entities. When you need one you query it from the context object
-
@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
-
@jestdotty Rust is a serious tool for serious programs
Rc<RefCell<>> doesn't work. Don't use it. Its a crutch if you don't know how Rust works
Think about the ownership and how it naturally flows via borrows. Think in a tree-like way where the seed is in the main function on the stack and you delegate things down the call stack instead of having a bunch of autonomous global objects which do their own thing
It's not always easy (the downside of memory safety in a systems lang) but it does work very well
But you have to divorce yourself from the typical Java-like grug programming style. You can't program Rust like a junior level webshit who only produces spaghetti
Its a serious tool which has to be wielded with serious thought how to use it -
@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
>.> -
@jestdotty Obviously just calling other cli tools in a bash script is easier and shorter than writing it yourself in a programming language. That's why the command line rules!
But also: There are areas were Rust can be annoying but CLI tools are absolutely perfect for Rust
Input -> Processing -> Output, all very nicely tree-like starting from the stack. No global variables, long running subprocesses, async, etc.
That's the one thing where Rusts ownership model works *very* well. If ya can't make *that* work in Rust that's really just on you -
@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 -
@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 -
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 -
@antigermanist Lets settle on bayrisch because it sounds funny
-
@Lensflare Just trolling ostream :P
-
Obviously they should all be in german since it's the better language
-
@jestdotty Ah got it
A table-like approach can actually be pretty good if you use the slotmap crate (e.g. one slotmap/"table" per entity), that's how I'm storing stuff in my compiler! I really don't like Rc<RefCell<>> at all. With slotmap(s) you can keep your ownership in one place and give it out via &mut instead of having to lock the refcell everywhere. Much cleaner in my opinion! (but of course also no silver bullet...)
I understand your frustration with JS interop... it can definitely suck trying to map such a dynamic language to a super static one like Rust -
dev.to is kinda gay (literally) but I guess you'll have bigger audience there
I'd make my own blog with a static site generator though, that's a lot cooler -
Just don't use lifetimes and don't use mutexes
Spawn "single threaded" tasks which communicate via channels. If you need shared data use immutable lists/maps from the`im` crate. I think that would fix like 90% of your issues with Rust
Like I know you're doing mostly async and async can be challenging but from what I understand you mostly do web based stuff. It *really* shouldn't give you that many issues to write a http client with a bit of data processing -
@antigermanist I mean, just don't miss the seat then or don't just throw your body down without feeling the seat with your butt
This doesn't seem like that big of a problem -
Don't know if trolling or not...
-
UML in 2025 lul
-
@whimsical I haven't thought too much about it :P
The users are really the problem; if you don't have any nobody will use it and then nobody will join :/ -
Stuff like this is often for a good reason. Like "what if the thing gets dropped in this very specific scenario, then we couldn't do X anymore" or "if we don't take the thing then it has to be bound by lifetime Y if we await inside here"
There's quite some complexity sometimes
Or maybe the library is just designed badly :P -
@whimsical I think a big reason why devRant is better is because its so much smaller. And because its smaller everybody can see and read every rant, so these filter bubbles that don't allow for other opinions can't form. On dR you also have to tolerate the things you don't typically like
I've been thinking about making a social media where people get secretely assigned to little invisible "groups" (maybe based on rough location?) and the feed then also shows them posts from that group with a higher likelihood
So you always have some natural diversity of opinion. I think it also *really* helps if you often see the same person. I don't like ostream but I've talked to him enough that I don't hate him as a person anymore (he's just a little "special" :P ), but if you always talk with strangers you tend to be less nice -
From experience so far it feels really cool and novel to let the AI do all the coding, but steering it in the right direction and making it fix all the bugs takes longer than writing it yourself :P
-
@BordedDev For real I just watched the latest devin video from theprimeagen and I wanted to scream the way he writes JS. Holy hell, sooooooo much boilerplate and repetition and a very small amount of actual business logic
Complete opposite to my rust code. Just goes to show that you can write good and bad code in any language! -
@BordedDev something something skill issue
-
@BordedDev *Everything* goes well with enough beer :P
-
@antigermanist Well that sucks
-
@BordedDev Goes well with döner 😋