Re:Rust: “Explain GATs Like I'm 5 Years Old”
by kibwen on Monday November 07, 2022 @10:45AM
(#33507292)
Just so that we're clear on acronyms for everyone out there, "GADT" is a computer science term for "generalized algebraic data type", which has no relation to "GAT", which is just Rust terminology for generics in associated types (even in Rust, I doubt that anyone will bother to refer to "GAT" in the coming years, rather than just lumping them in with the concept of associated types in general; there's really no need to teach them separately).
Re:Rust: “Explain GATs Like I'm 5 Years Old”
by ghostwriter on Monday November 07, 2022 @06:11PM
(#33513852)
> you could make a generic `map` function that worked on any container type.
not only container types, it can be any type that has a consistent context of evaluation for the final value being calculated: "doing async IO", "doing optional presence", "doing potentially erroneous extraction", and so on. In that sense, "doing multiplicity of values" is the context expressing a container type you mentioned as an example.
Not a Rust guy but I think that's the idea.