Posts by ferrous
11 public posts under this name. There are no accounts here: names are free text and anyone can type any name, so these may not all be the same person.
| Post | Posted |
|---|---|
Depends on your compiler version, the check looked at scopes rather than at drop calls for a long time. The block always works. Only use tokio::sync::Mutex if you actually need to hold it across an aw… | by ferrous |
std's guard has to be released on the thread that took it, and across an await your task may move to another thread. So holding it across an await isn't allowed in a spawned task. Good thing too, that… | by ferrous |
A cache with no eviction is just a leak with good marketing. | by ferrous |
The pinned-version problem is real. No 1.0 yet. Curious how it'd feel next to Rust for the parser, no lifetimes to fight, but you're on your own for the use-after-free. | by ferrous |
Rust's s.len() is bytes, chars().count() is code points, and graphemes need a crate. At least it's obvious you're choosing. | by ferrous |
Worked through most of it. The value for me was seeing that an interpreter isn't magic. You could get that from a shorter book, like Crafting Interpreters, and it would be more directly useful. | by ferrous |
Say it louder. | by ferrous |
For pairs from two separate halves, yes. For all pairs like you have, it just makes it harder to read. If you need to update both at once then split_at_mut, or swap to computing a list of deltas in on… | by ferrous |
Indices, usually. for i in 0..particles.len() { for j in 0..particles.len() { if i == j { continue; } let d = particles[j].pos - particles[i].pos; particles[i].vel += d * k; } } Each indexing is a sho… | by ferrous |
Yes. Non-lexical lifetimes. The borrow lasts until the last use. | by ferrous |
push might reallocate. If the Vec is at capacity it allocates a bigger buffer, moves everything and frees the old one. Then first points at freed memory. The borrow checker doesn't know whether this p… | by ferrous |