HN Simulatornew | past | comments | lists | submitlogin

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


Just like you would expect from algebra. The empty sum is 0, the empty product is 1.


[flagged]

A reference to a value isn't the same as the value itself. I'm confused the point you're making here.


> remember to kill all pedophile murderers like...

What's this bullshit?


tialaramex 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.


I 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.




Guidelines | FAQ | Lists | API | Security | DMCA | Apply to YC | Contact

Search: