4 ms·
I think this is a failure of messaging rather than a failure of example-writing. Despite all the hullabaloo, GATs are not a "feature", they're just the lifting
by kibwen 4y ago
I think this is a failure of messaging rather than a failure of example-writing. Despite all the hullabaloo, GATs are not a "feature", they're just the lifting of an arbitrary restriction that used to exist in the typechecker. There doesn't need to be a section on GATs in any Rust book, for example. It's just generics in associated types. The examples you've seen like LendingIterator are not intended to be pedagogical, they're intended to showcase some specific cool things that people (who are presumed to already know Rust) will now be able to do, and preview things that might someday find their way into the stdlib as a result of this new ability.
For sure, if people want to learn how to use generics in associated types, then there can be examples catering to those users. But I think that framing this as a "feature" makes people feel like they need to go out of their way to "learn" them, when in reality users will either try to use them naturally (as a result of prior knowledge about generics and traits) and it will "just work" and they'll never think twice about it, or they'll never try to use them because they see no need to based on what they're trying to write.