|
|
|
|
|
by camus2
3220 days ago
|
|
> There is. Go simply has structural subtyping [1] rather than nominal subtyping. No there is not, period. interface {
foo() int
}
is not sub typing. but it's interesting how you move the goal post on each comment. You go from inheritance to sub typing to "structural subtyping". You're not interested in a serious discussion. |
|
This is an assertion, not an argument. It's not how the literature sees it. Plus, you can even have it from Rob Pike himself if you don't believe me: https://twitter.com/rob_pike/status/546973312543227904
> is not sub typing. but it's interesting how you move the goal post on each comment.
I didn't say that this piece of code constituted subtyping. Here, I was refuting your specific claim that the equivalent of `f` cannot be written in Go.
> You go from inheritance to sub typing to "structural subtyping".
This is not how the thread went. I added a reference to structural subtyping as a purely explanatory footnote to illustrate a well-known similarity between OCaml and Go; subtyping had not been mentioned at all so far. Starting at that footnote, you introduced a digression by claiming that Go does not have subtyping at all.