|
Symbolic Butt posted:the1percent/the99percent
|
![]() |
|
![]()
|
# ? Jun 6, 2023 20:35 |
gru/minion
|
|
![]() |
|
VikingofRock posted:gru/minion
|
![]() |
|
ctps:code:
|
![]() |
|
gonadic io posted:ctps: ![]()
|
![]() |
before posting that you oughta warn us to brace ourselves!
|
|
![]() |
|
VikingofRock posted:before posting that you oughta warn us to brace ourselves! ![]() i'm just loving around writing a scrabble thing but got caught in a bunch of nested loops: https://github.com/djmcgill/Rubble/blob/master/src/main.rs i might legit try something like https://github.com/TeXitoi/rust-mdo to let me nest loops without increasing indentation which i could do with a bunch of and_then idk
|
![]() |
gonadic io posted:
I think that's a bit overkill here. I got rid of four levels of indentation by replacing your match statements with if lets. It even fits within 80 columns now! IMO this sort of strategy is the way to go when only one match arm can logically continue the function. As for the rest of the indentation, most of it comes from nested for loops. A lot of times those can be logically separated out into an iterator, which can then be chained together in all the usual ways. For example here you could imagine making an ConnectedTiles iterator that returns all tiles connected to a given start tile and then in all_tiles_connected() just return whether your total tile count is the same as connected_tiles(arbitrary_tile).count(), or for the inner loop you could make a Neighbors iterator which gives the neighbors of a given tile. VikingofRock fucked around with this message at 22:49 on Sep 13, 2018 |
|
![]() |
|
i think using let match would look a bit nicer than if let:code:
code:
|
![]() |
Lime posted:i think using let match would look a bit nicer than if let: ![]()
|
|
![]() |
|
in my opinion the all_tiles_connected method is just begging to be broken into at least 3 methods there
|
![]() |
|
ty for the suggestions. the lack of early return from a mapping closure bothers me way more than i thought it would. maybe generators solves this?
|
![]() |
gonadic io posted:ty for the suggestions. the lack of early return from a mapping closure bothers me way more than i thought it would. maybe generators solves this? I recently ran into a way to get around this. The idea is you use filter_map() to end iteration early and then check a sentinel value. code:
You could pretty easily extend this to returning things besides Option or Result. Whether this is a clever trick or a dirty hack is left as an exercise to the reader.
|
|
![]() |
|
FB's PHP compiler to end support for PHP: https://hhvm.com/blog/2018/09/12/end-of-php-support-future-of-hack.html
|
![]() |
|
VikingofRock posted:I recently ran into a way to get around this. The idea is you use filter_map() to end iteration early and then check a sentinel value. lol nice 1) use the failure crate for all projects imo 2) there is an either crate too but you might have to duplicate the machinery and they're the same thing anyway so why bother gonadic io fucked around with this message at 02:15 on Sep 14, 2018 |
![]() |
|
you cna have short-circuiting iterators with generators - playground e: although if you're writing a custom looping function I guess you can just do the same thing with options but with None and Some instead of Yield and Return code:
gonadic io fucked around with this message at 02:26 on Sep 14, 2018 |
![]() |
|
prisoner of waffles posted:FB's PHP compiler to end support for PHP: https://hhvm.com/blog/2018/09/12/end-of-php-support-future-of-hack.html
|
![]() |
|
jonathan blow is mad about rust: https://www.youtube.com/watch?v=4t1K66dMhWk dont watch the video. it's way too long. it sucks
|
![]() |
|
animist posted:jonathan blow is mad about rust: I'm the voice he does here: https://www.youtube.com/watch?v=4t1K66dMhWk&t=711s
|
![]() |
|
People care about what that dude thinks about anything?
|
![]() |
|
brand engager posted:People care about what that dude thinks about anything? yes unfortunately Symbolic Butt posted:I'm the voice he does here: im the part where he unironically says "Like a lot of new programming languages are made by people who just are making small stylistic changes..." without any self awareness whatsoever ![]()
|
![]() |
ctps: defending my dissertation today somehow all this terrible programming paid off!
|
|
![]() |
|
lmao the first mention of it I see on my twitter feed is a thread making GBS threads on him https://twitter.com/ManishEarth/status/1040599002557960197
|
![]() |
|
brand engager posted:lmao the first mention of it I see on my twitter feed is a thread making GBS threads on him I measured 30 mins for what only seemed the first 10s of her talk, though her presentation sounds a lot worse than his. Also, he's probably right.
|
![]() |
|
animist posted:jonathan blow animist posted:dont watch that's a given
|
![]() |
|
MrMoo posted:I measured 30 mins for what only seemed the first 10s of her talk, though her presentation sounds a lot worse than his. Also, he's probably right. Jonathan blow is never right
|
![]() |
|
I watched almost all of it, around 30min he finally gets to the main point which is this:Jonathan Blow posted:it seems like a little bit of Stockholm's syndrome to me where it's like "oh the borrow checker is so good because it made me program in this certain pattern. but the real reason the borrow checker is not complaining anymore is just that I managed to turn it off but I didn't realize that that's what I did" and he isn't 100% sure if that's what's really going on, which is fine but I'm not sure why he is wrapping this query in an 1 hour long video rant btw this is a pattern that I noticed about rust programmers before and in the end maybe he kinda has a point here but just lol at jblow
|
![]() |
VikingofRock posted:ctps: defending my dissertation today good luck
|
|
![]() |
|
Symbolic Butt posted:I watched almost all of it, around 30min he finally gets to the main point which is this: You mean smashing keys until it works doesn't leave you with a greater understanding of what's happening underneath? Hot Take!
|
![]() |
|
Hi, I'm a fng learning Java and I need help with my first set of Homework for my programming class ![]() I'll be willing to paypal or venmo you $ for the time spent helping me. Feel free to send a PM if it interests you. Also, feel free to own me for being such an idiot and posting this in this thread. Thanks!
|
![]() |
|
what’s a fng
|
![]() |
|
loving new guy
|
![]() |
|
Symbolic Butt posted:I watched almost all of it, around 30min he finally gets to the main point which is this: I don't really see how jblow's paraphrased criticism is applicable, and I'm not willing to watch an hour long rant to see him ignore all the benefits of the system edit: i guess the other interpretation here is i guess he means you start programming in a style you don't need to constantly borrow poo poo in the first place like you might in other languages? i really don't see anything wrong with this comedyblissoption fucked around with this message at 20:02 on Sep 14, 2018 |
![]() |
|
*jblow voice* you really need to use a smart pointer here
|
![]() |
|
comedyblissoption posted:the only way you "turn off" the static borrow checker is wrapping your stuff in abstractions like RC (like reference-counted smart pointers) though, and rust idioms typically don't require you to do this his thesis is something like "she unwittingly wrote an arena-style memory allocator to fool the borrow checker" which seems to be the usual way to go in games written in C++ anyway. but anyway I still didn't watch the original video by the rust programmer yet but I'm beginning to suspect that she didn't really imply what he's saying she implied, that the "righteous borrow checker guided her to do the right design".
|
![]() |
|
Symbolic Butt posted:his thesis is something like "she unwittingly wrote an arena-style memory allocator to fool the borrow checker" which seems to be the usual way to go in games written in C++ anyway. lol but she didn't. jblow has this terrible affliction where he opens his mouth sticks his foot into it and then blames feminism for why he's getting dunked on for his dumb as hell views. please think of this rational, clearly thick skinned, reasonable man's feelings also, just fuckin' lol at an hour long response to a 5 minute portion of a 45 minutes video he didn't watch all the way through (also, rust doesn't permit per-container allocators yet, so no, she did not write an arena allocator. she wrote an ecs in rust where she doesnt have to worry about an invalid entity bringing the entire system to its knees)
|
![]() |
|
Symbolic Butt posted:I'm beginning to suspect that she didn't really imply what he's saying she implied, that the "righteous borrow checker guided her to do the right design". iirc the first half of the keynote was in c++, she showed how traditional OO poo poo completely falls apart for games, and why ECS is good design. then she moves over to rust, and shows that ECS has a bunch of benefits aside from working well with the borrow checker. MrMoo posted:Also, he's probably right. ![]()
|
![]() |
|
Slurps Mad Rips posted:(also, rust doesn't permit per-container allocators yet, so no, she did not write an arena allocator. she wrote an ecs in rust where she doesnt have to worry about an invalid entity bringing the entire system to its knees) He covered that, he calls it "arena" according-to-him, but not what other people (tm) may understand as that. Invalid entity is fairly mild and Blow says a crash would be better than hiding it because you can go debugging and fix it quickly. The allocator scheme she creates allegedly does not eliminate an incorrect but valid entity being presented due to possessing a stale reference and so the language is not really helping at all and required the same development strategy other languages require too.
|
![]() |
|
What is an ecs
|
![]() |
|
![]()
|
# ? Jun 6, 2023 20:35 |
|
Sapozhnik posted:What is an ecs entity component system
|
![]() |