Re:Go 1.16 Release Notes
by cutler on Tuesday February 16, 2021 @09:20PM
(#26161839)
Go's structs with associated methods and property/method promotion aren't that different from classic OOP. Too much is made of the differences, I think. You can recreate most basic OOP code in Go .... if you really must.
[ Parent
| on HN ]
I do think it’s very different; types are not classes and interfaces are not like interfaces in java, obj-c for example, being defined at point of use.
If you try to recreate inheritance in Go it will be frustrating and not very useful.
The shape of the code ends up very different and embedding is not used even half as much as inheritance (which is the default position in most other oop languages). That has profound impacts.
It is basically Component Based Programming, started with Objective-C protocols, Smalltalk categories, Java/.NET interfaces, COM ABI.
inheritance is just like in COM via delegation and struct embedding.