I think Go interfaces are row-polymorphic aren't they? I'm also wondering what the difference between row-polymorphism and ad-hoc polymorphism (a la C++ templates) is.
Yes, Go interfaces are row-polymorphic, in the sense that they allow you to write functions that operate on any struct which has a field with a certain name and type.
This utilizes the fact that structs implement interfaces implicitly in Go, rather than explicitly.
> I'm also wondering what the difference between row-polymorphism and ad-hoc polymorphism (a la C++ templates) is
C++ templates can also be row-polymorphic. They're a lot more flexible than just row polymorphism, though, because they essentially allow you to be polymorphic over any type for which a given expression is valid syntax.
Concepts were an attempt to allow developers to rein in some of that flexibility, since it actually became a pain.
Yes, Go interfaces are row-polymorphic, in the sense that they allow you to write functions that operate on any struct which has a field with a certain name and type.
This utilizes the fact that structs implement interfaces implicitly in Go, rather than explicitly.
> I'm also wondering what the difference between row-polymorphism and ad-hoc polymorphism (a la C++ templates) is
C++ templates can also be row-polymorphic. They're a lot more flexible than just row polymorphism, though, because they essentially allow you to be polymorphic over any type for which a given expression is valid syntax.
Concepts were an attempt to allow developers to rein in some of that flexibility, since it actually became a pain.