3 ms·
Well you are right, the name does make sense, but I would have thought "union" would have made more sense than "enum" for those of us from the C-family. OTOH I
by nemothekid 12y ago
Well you are right, the name does make sense, but I would have thought "union" would have made more sense than "enum" for those of us from the C-family.
OTOH I haven't written a line of Rust of yet, so enum might be more familiar in use.
- masklinn 12y ago> Well you are right, the name does make sense, but I would have thought "union" would have made more sense than "enum" for those of us from the C-family. The issue with `union` is it might hint at things which are not available (e.g. the union of an int and a float where you can access to the raw data as either). A Rust enum is really an encoding of the `struct { enum, union }` pattern, but it degenerates to an enum if there's no union part (no data payload), not to a union. So calling it an enum makes more sense.