Re:Rust: “Explain GATs Like I'm 5 Years Old”
by GolDDranks on Monday November 07, 2022 @10:14AM
(#33506836)
The part that says `T<i32>`. GATs don't allow you to do that, not directly. GATs allow you, as said by Boats in https://news.ycombinator.com/item?id=33506540, have a generic type as an associated type, nothing less, nothing more. If you want to express `T<i32>`, GATs _enables_ you to do that as a kind of a distorted encoding, but it's not as simple as https://news.ycombinator.com/item?id=33505810 makes it seem.
[ Parent
| on HN ]
Re:Rust: “Explain GATs Like I'm 5 Years Old”
by howinteresting on Monday November 07, 2022 @10:54AM
(#33507437)
Bring able to abstract over Rc/RefCell and Arc/Mutex with marker types seems pretty useful. It's not directly HKT but it enables use cases that would otherwise be supported by HKT.
Re:Rust: “Explain GATs Like I'm 5 Years Old”
by dllthomas on Monday November 07, 2022 @12:03PM
(#33508603)
Yes, but that doesn't make it somehow accurate to explain HKT and pretend you're explaining GAT...
Re:Rust: “Explain GATs Like I'm 5 Years Old”
by howinteresting on Monday November 07, 2022 @12:16PM
(#33508811)
That is definitely true.