Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think the "object"-less OO tag is a bit overblown. Structs are objects. Just because Go creators didn't choose to name them that doesn't mean there's a fundamental difference between Go structs and other languages' objects.


The fundamental difference (and there is one), is that Go omits the concept of inheritance, preferring composition instead. So in contrast to many mainstream languages today - Java, Obj-C, C#, C++, Ruby, Python, PHP , etc. there is no concept of inheritance, only composition of objects and conforming to interfaces.

There's a good quote in the article about this under 'Inheritance Is Best Left Out' - James Gosling responds to someone asking what he'd change in Java in retrospect - “I’d leave out classes,” he replied.


>>The fundamental difference (and there is one), is that Go omits the concept of inheritance, preferring composition instead

Right, but that doesn't mean Go is not object oriented, it simply eschews inheritance for composition. Go also offers something else n lieu of inheritance that many other OO languages don't have, embedding.


"O-O is important because it provides uniformity of interface. Subtype inheritance encourages non-uniform interfaces." - Rob Pike http://www.infoq.com/presentations/Go-Google 43:00


Yea, I liked the idea of what go was waning to do. They wanted classes and objects without the classes and inheritance, but all they've done is replace that headache with an interface headache.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: