31 Dec 2023 |
.vhyrro | yep | 14:57:33 |
.vhyrro | because the type system says "yeah mate this will work" | 14:57:39 |
.vhyrro | and then you actually use it and it goes "uh ackshually" 🤓 | 14:57:53 |
_gilfoyle_ | if theres a small bug in a part of the code, remove the part | 14:58:19 |
_gilfoyle_ | classic | 14:58:22 |
max397 | well ackshually | 14:59:46 |
max397 | hrsh7th mindset | 14:59:55 |
max397 | shame one you .vhyrro | 14:59:58 |
_gilfoyle_ | shame two you .vhyrro | 15:00:21 |
.vhyrro | bro | 15:00:25 |
.vhyrro | some things in rust simply can't be done unless you Arc<RefCell<#>> it, and I am not planning to Arc<Refcell<#>> anything | 15:00:53 |
.vhyrro | hence, delete | 15:00:56 |
.vhyrro | not worth the time | 15:01:00 |
.vhyrro | when is zig getting a working package manager i need to be saved already | 15:01:30 |
max397 | | 15:01:45 |
.vhyrro | const val = func() catch |err| {...}; my beloved | 15:01:53 |
max397 | well I'm just about to do that rn | 15:02:03 |
.vhyrro | sevoris added a possibility for each individual norgopolis module to also set a timeout before it disconnects forcefully from norgopolis | 15:03:19 |
max397 | Redacted or Malformed Event | 15:03:32 |
.vhyrro | so e.g. if we would like norgberg to linger around for more than 5 minutes at a time before shutting off we now can | 15:03:33 |
max397 | Download image.png | 15:03:34 |
max397 | | 15:03:35 |
max397 | RefCell > * it seems | 15:03:49 |
.vhyrro | damn you can just fix a memory leak awesome | 15:03:52 |
max397 | vhyrro Arc<Mutex> vs Rc<RefCell<#>> | 15:04:08 |
.vhyrro | mutexes are for data across threads | 15:04:20 |
.vhyrro | refcells are for when you need mutability in places where rust cries that you can't have mutability | 15:04:29 |
max397 | ic | 15:04:47 |
.vhyrro | Rc is regular reference counting but if you're sharing stuff across threads you want Arc | 15:04:54 |
max397 | like here
fn main() {
// Create a Vec
let mut my_vec = vec![1, 2, 3];
// Create multiple immutable references to the Vec
let ref1 = &my_vec;
let ref2 = &my_vec;
// You can read from the references
println!("Reference 1: {:?}", ref1);
println!("Reference 2: {:?}", ref2);
// You can still modify the original Vec
my_vec.push(4);
// Print the references again
println!("Reference 1 after modification: {:?}", ref1);
println!("Reference 2 after modification: {:?}", ref2);
} ` | 15:04:58 |