News for hackers. Stuff that matters.
Re:Rust Weird Expressions by samus on Tuesday May 18, 2021 @05:43AM (#27192768)
Similar debates exist in all programming languages with algebraic data types. `Either<(), a>` vs. `Maybe a` and stuff. Category-theoretically, they are the same of course. But in non-strict languages `Either<(), a>` allows another opportunity to hide an `undefined`: `Left undefined`.
Re:Rust Weird Expressions by iudqnolq on Tuesday May 18, 2021 @11:42AM (#27196176)
I find it beautiful that HashSet<T> in Rust is a thin wrapper around HashMap<T, ()>. I'm glad it's a wrapper, though. I wouldn't like it if everyone had to write `HashMap<u16, ()>` and so on and know which methods still made sense.