Scratch that, we do fairly early too, I just missed it https://doc.rust-lang.org/book/ch05-01-defining-structs.html?highlight=tuple,struct#using-tuple-structs-without-named-fields-to-create-different-types …
-
-
So in The Book we call them "tuple struct"s, and when we introduce the concept for enums we don't give it a name, but we could use "tuple struct variant"...
1 reply 0 retweets 1 like -
@oli_obk,@ManishEarth,@killercup,@yaahc_,@mgattozzi,@QuietMisdreavus,@Carols10cents,@steveklabnik what do y'all think? Should we try and normalize naming of `struct S()` and `enum E { V() }` to be "tuple struct" and "tuple struct variant"?4 replies 0 retweets 2 likes -
Tuple struct variant sounds weird to me, because it makes me think of struct variants. Tuple enum variant or tuple-like enum variant seems fine to me: it seems like "Tuple variant" is the confusing one
1 reply 0 retweets 3 likes -
Replying to @ManishEarth @ekuber and
I think putting the word "struct" in anything that is not a struct or a struct-like enum variant would cause further confusion
1 reply 0 retweets 3 likes -
Replying to @ManishEarth @ekuber and
or maybe the error message should be "__ has not been been previously defined as a function, struct or enum"... ?
1 reply 0 retweets 2 likes -
Replying to @ultrasaurus @ekuber and
Nah, struct and enum names occupy a different namespace (you're brushing close to a subtlety of rust imports in that there are three different namespaces for things, but sometimes things (like tuple or unit structs) occupy multiple ones. this isn't super important to know)
1 reply 0 retweets 7 likes -
Replying to @ManishEarth @ultrasaurus and
But in the case in the original blogpost (`return OK(42);`) it *could* be an fn, tuple-like struct or an enum variant (if imported).
1 reply 0 retweets 3 likes -
Replying to @ekuber @ultrasaurus and
right, but enum variant != enum (trying to guard against the case where in attempting to fix one diagnostics confusion we create another)
2 replies 0 retweets 5 likes -
Replying to @ManishEarth @ekuber and
seems like Rust has two kinds of named tuples -- those defined with enum keyword or struct keyword. So we can think of enum tuple and struct tuples as tuple variants, but perhaps the term "tuple variant" is the confusing part...
3 replies 0 retweets 1 like
I don't think I've ever heard or said the phrase "tuple variant"...
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.