4 ms·
I seriously doubt a 5 year old can understand this explanation.
by mseepgood 4y ago
I seriously doubt a 5 year old can understand this explanation.
- lsllc 4y agoThere's another (better) example down in the comments using a PointerFamily trait; someone asked "ELI4" and the answer is pretty good: https://old.reddit.com/r/rust/comments/ynvm8a/could_someone_explain_the_gats_like_i_was_5/ivcax9t/ https://old.reddit.com/r/rust/comments/ynvm8a/could_someone_...
- royjacobs 4y agoI mean, a GAT is just a monoid in the category of endofunctors, after all.
- kibwen 4y agoGATs don't actually let you go full monad, so not quite. :P
- deleted 4y ago[deleted]
- fleur-de-lotus 4y agoDon't insult me !
- hitpointdrew 4y agoI am over 30 and I don't understand the explanation. Probably because first and foremost I don't even know what a "GAT" or "GATs" are/is.
- kibwen 4y ago"Generic Associated Type". Explained in other terms, a generic is just a parameter for types, analogous to how `x` is a value parameter for the function call `foo(x)`. Meanwhile, an associated type is just a type alias that's associated with a trait (a trait is a class, but with no state), similar to how traits can have associated functions (which are also known as "methods"). GATs, then, "just" let you use generics in associated types, which was previously unsupported in Rust.
- jerf 4y agoIt's arguably in the category of "pet peeve" more than anything else, but I really hate the ELI5 meme and suspect most people asking for it and/or trying to provide explanations that fit it have never had a five-year-old. Unless your target five year old is a five year old Terence Tao, and honestly even then, most of the time these are terrible. ELI12 would make a lot more sense; old enough to have had enough life experience to hang some of these explanations off of, young enough to need simple explanations.