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
-
Lensflare2062524dEvery general purpose language is imperative. You have no clue what you are talking about.
-
12bitfloat1078023d@Lensflare Except for functional ones
And now take a guess why you have never heard a singular product built with one... -
Lensflare2062523d@12bitfloat yeah, then they are most likely not general purpose.
Jesty is probably thinking that JS is not imperative. -
whimsical83423d@12bitfloat no no no, I mean lame products made with a functional programming language. Rust is bootstrapped with ocaml. Noob :p
-
jestdotty652123d@12bitfloat there are two types of languages
those that people complain about and those that nobody uses -
jestdotty652123dhow readable is this redundant 102-120 loop: https://play.rust-lang.org//...
and to say nothing about this idea of passing enums between processes: https://play.rust-lang.org//...
it's like opcodes. such a mess. you never know if one is handled in the appropriate place or what -
12bitfloat1078023d@jestdotty Looks pretty good honestly. I don't really know what in that code you're complaining about
I guess if you're complaining about having to "flip-flop" messages with new_messages: Instead of the .drain you could use a VecDeque: https://play.rust-lang.org//... -
jestdotty652123d@12bitfloat RAAGHHH SPAGHETTI
I might go back to rc refcell, then do downcasts to concrete types and do direct calls. the events seem like a nightmare
control flow all over the place. have fun trying to find where the enum is used without querying the IDE -
12bitfloat1078023d@jestdotty Rc vs HashMap is orthogonal to events vs direct functions
You can just replace the message system with function calls (change_energy(), change_body()) and pass in the context and the entity id
That's how I would do it, I think that's pretty clean -
12bitfloat1078023d@jestdotty Yeah I get you
Then for what I said you would emulate downcasting yourself with an enum that stores an id for one of the different entity kinds. Then have a downcast_as_entity or whatever that you pass the context and the generic id and it'll check if its the right enum variant and then give you the reference or something like that -
12bitfloat1078023d@jestdotty This is how I would do it:
https://play.rust-lang.org//...
I think this pattern is pretty damn ergonomic and flexible without having to fight the borrow checker
(actually quite proud of this one... probably gonna start using this pattern myself from now on :P) -
12bitfloat1078022d@jestdotty You don't have to do the insert_with_key and me stuff (normal insert is fine), then its a bit more obvious. I just like that all entities know their own key, just in case you pass an entity by ref to a function, you can still figure out its id
-
12bitfloat1078022d@Lensflare No i was more thinking about games (which creeps is)
I don't actually know what "objects" are called in Rust... I know C++ has objects and subobjects as real concepts -
Lensflare2062522d@12bitfloat ah, got it.
I don’t like "object" either, because IMO it implies OOP, even if you don’t use OOP. Also, people don’t typically think of "primitives" such as int and bool as "objects". (Thanks, Java and fuck you!)
"Instance of a type" is too wordy and just "instance" is too vague.
Sometimes I also say "value" but that is often associated with just numbers.
And "entity" is for games and databases. -
Lensflare2062522d@jestdotty
> entity is a catchall for "thing" that other things are attached to.
No, it‘s not. An entity doesn’t need to have other things attached to it to be called entity. -
Lensflare2062521d@jestdotty nothing that you quoted supports your claim of "other things attached to it".
You are just wrong and I told you so in the most neutral way possible.
You seem to be insulted or pissed about that.
Now ask yourself the questions that you are asking me: Why? What‘s the point? Are you desperately trying to win?
Your ego is really something special. -
12bitfloat1078021d@jestdotty Kinda offtopic but did you try slotmaps yet?
Even better, I was nerdsniped by you and have spend the last two days writing a really fucking cool container lib in Rust. Its like slotmap but you can insert and delete items even without a &mut reference! Even EVEN better you can also iterate over the collection WHILE adding or deleting items down the callstack
AND its pretty damn efficient
in imperative languages spaghetti code might just be the lay of the land
rant