2 ms·
Note, to be more clear, an enum with no variants has no values of that type (can't be constructed), and a struct with no fields has exactly one value of that ty
by nextaccountic 13d ago
Note, to be more clear, an enum with no variants has no values of that type (can't be constructed), and a struct with no fields has exactly one value of that type
- teiferer 13d agoJust like you would expect from algebra. The empty sum is 0, the empty product is 1.
- aissi 13d ago[flagged]
- nixpulvis 13d agoA reference to a value isn't the same as the value itself. I'm confused the point you're making here.
- horseduck 13d agotialaramex got it wrong even at the type theory level, a size of 0 is the wrong focus, the number of elements, 1, should have been the focus.
- kibwen 13d agoI wouldn't say they got it wrong exactly. Uninhabited types aren't equivalent to unit types, but in terms of Rust they're both classified as zero-size, and I suspect they were just pointing out that Rust has optimized and special-cased zero-sized types accordingly since time immemorial.
- red75prime 13d ago> remember to kill all pedophile murderers like... What's this bullshit?