How does this compare to "Accept interfaces, return structs" in Go?
How does this compare to "Accept interfaces, return structs" in Go?
Posted Apr 25, 2024 14:00 UTC (Thu) by daroc (editor, #160859)In reply to: How does this compare to "Accept interfaces, return structs" in Go? by davecb
Parent article: Existential types in Rust
When I described the topic of the article to my mother, she suggested that "existential types" ought to refer to philosophers who sit around in cafés smoking very thin cigarettes and avoiding writing poetry. So it's clearly a term with many possible meanings. :-)
In regards to your question to how this compares to Go — I have never written any Go, so I can't say for sure, but it certainly sounds like the same technique from your description, possibly with less involvement from the type system. I think a lot of programming languages can express a pattern like this, it's just a matter of the tradeoffs between runtime overhead, safety, and type-system complexity.
