3 ms·
From a high level programming in Go looks to me to be very like programming with Microsoft's COM. It's interface oriented, no inheritance. You could say that th
by discreteevent 14y ago
From a high level programming in Go looks to me
to be very like programming with Microsoft's
COM. It's interface oriented, no inheritance. You could say that
this is the purest form of OO if you take Alan
Kay's viewpoint that the emphasis should be on
the messages and not the object. In COM you
have QueryInterface and in Go you have interface
matching and casting. QueryInterface or an
interface cast is like a hinge between dynamic
and static typing. You get great flexibility but still
preserve your abstractions in that you never
depend on an implementation.
Of course you can
do this in, say, java by using instanceof to match
against an interface but the difference with COM
and Go is that it is a primary mechanism and so
the code written in the language tends to use this
pattern a lot. i.e. It's encouraged.
See this example from Russ Cox:
https://groups.google.com/forum/#!msg/golang- https://groups.google.com/forum/#!msg/golang-
nuts/Rj5t1h_ztxI/Fgs6HfLqMHAJ