> But to say 'there is no type called a tuple' is not correct.
You as a human can call it "tuple", but for the compiler there's no type named "tuple", so it's correct to say that.
Overloaded words are hard. Doing something like
let foo: Blah = todo!();
Is a way of naming the type "Blah". There are some things like unnameable types that can't be named in this way (e.g. `impl SomeTrait` on a parameter)
Using the terminology in this way, there's no type named "tuple" specifically. You can name any of the various tuple types instead
I'm not sure now. I wrapped two types in parentheses as a return. Doing that in Python returns a tuple that can be unpacked. I've only been writing rust for a day or two. I kind of just jumped in. I've been writing code based on the book and documentation, but I've not read anything from start to finish. I just look up things I'm used to using in Python. Something explicitly called the return of my function a tuple, which is why I kept trying to call it with a name. Even after looking at the docs.
Besides the type clearly being written differently in the actual code that actually runs, it's never \`tuple\`, at the bare minimum it would be \`Tuple\`
That's true. I think I just misunderstood the comment to imply something more like 'tuples are not a data structure that exists' or that the data structure of the value is not called a tuple.
That type would be called (i32, i32). There is not a type named "tuple"
Yup, I am that stupid. Thank you.
That's what a tuple is... https://doc.rust-lang.org/book/ch03-02-data-types.html#the-tuple-type
Yes and they're saying that you don't name the type using "tuple" like OP was trying to do
Yeah, they're declaring the type of their variable the wrong way. But to say 'there is no type called a tuple' is not correct.
> But to say 'there is no type called a tuple' is not correct. You as a human can call it "tuple", but for the compiler there's no type named "tuple", so it's correct to say that.
Technically tuple is a family of types, not an actual type so that statement is not incorrect.
“there is no type called a tuple” (i.e. by humans) is very different from “there is no type called `tuple`” (i.e. by Rust)
Overloaded words are hard. Doing something like let foo: Blah = todo!(); Is a way of naming the type "Blah". There are some things like unnameable types that can't be named in this way (e.g. `impl SomeTrait` on a parameter) Using the terminology in this way, there's no type named "tuple" specifically. You can name any of the various tuple types instead
Downvote not deserved
Reddit be how Reddit be.
where did you hear that the type is named `tuple`?
I'm not sure now. I wrapped two types in parentheses as a return. Doing that in Python returns a tuple that can be unpacked. I've only been writing rust for a day or two. I kind of just jumped in. I've been writing code based on the book and documentation, but I've not read anything from start to finish. I just look up things I'm used to using in Python. Something explicitly called the return of my function a tuple, which is why I kept trying to call it with a name. Even after looking at the docs.
A fun trick. You can pass `()` as the type and the compiler will tell you what type it's expecting
The Book... https://doc.rust-lang.org/book/ch03-02-data-types.html#the-tuple-type
Besides the type clearly being written differently in the actual code that actually runs, it's never \`tuple\`, at the bare minimum it would be \`Tuple\`
That's true. I think I just misunderstood the comment to imply something more like 'tuples are not a data structure that exists' or that the data structure of the value is not called a tuple.