News for hackers. Stuff that matters.
Re:Using enums to represent state in Rust by flohofwoe on Friday September 22, 2023 @10:17AM (#37612375)
I agree that something like 'sum type' sounds a bit too esoteric, but IMHO 'tagged union' is very descriptive. It's the same thing as a C union plus a tag indicating the currently active content (and that's also what the memory layout looks like under the hood).

(but yeah, 'enum with arguments' also describes it very well)

Re:Using enums to represent state in Rust by LoganDark on Friday September 22, 2023 @11:49AM (#37613570)
They do point them out as tagged unions many times in the documentation. But the syntax `tagged_union Whatever {}` doesn't exactly have me jumping out of my seat.
Re:Using enums to represent state in Rust by pavlov on Friday September 22, 2023 @02:33PM (#37615847)
It’s not like “enum” and “mut” are complete English words either, so maybe an abbreviation like “tun” could have worked.

But honestly I think enum was a better choice.

Re:Using enums to represent state in Rust by LoganDark on Friday September 22, 2023 @04:25PM (#37617308)
I personally think enum was basically the only reasonable choice, as normal enums really are just a subset of tagged unions. They just happen to support tagged unions on top of them.