News for hackers. Stuff that matters.
Re:Higher RAII and the seven arcane uses of linear types by amluto on Tuesday May 14, 2024 @11:25PM (#40362769)
I think all of this is great, except that you’re triggering my biggest pet peeve about linear types: the name :)

Seriously, though, every time I hear it, I think “hehe, ‘linear’ is like ‘affine’ but even more restrictive. Math is great!” (I hope there’s some better justification for the name.)

Maybe a more descriptive name like “must_consume” would be better? I very much appreciate how Rust took the concepts of covariant and contravariant types (and invariant types, which are not the same as what programmers think of as “invariants”) and made the user-facing feature be “phantom” instead. It’s much, much easier to remember what a phantom does than to remember which style of variance is “co” and which is “contra.”

Re:Higher RAII and the seven arcane uses of linear types by glandium on Wednesday May 15, 2024 @12:42AM (#40363172)
Simple uses of phantom are easy to remember, but the obscure ones are just as hard as remembering what type of variance co and contra are. https://doc.rust-lang.org/nomicon/phantom-data.html#table-of...
Re:Higher RAII and the seven arcane uses of linear types by dullcrisp on Wednesday May 15, 2024 @07:23PM (#40373541)
I could be wrong but I’m pretty sure affine types were named after linear types, not vice versa.