loading...

re: Is Go an Object Oriented language? VIEW POST

TOP OF THREAD FULL DISCUSSION
re: You forgot to mention that methods also can be applied to any type and not only Structs. For example this is valid: package main import ( "...
 

That is a great feature indeed you are right but not really forgot. I also didn't mention type functions, Interfaces etc. Maybe in another post :) The main goal is to show the the difference between a classical Struct and a classical Class. Assigning methods to primitive types is a bonus that normal OO languages don't have so not really necessary to compare as there isn't any comparison.

 

What's a "normal OO language"? A distinction between primitive types and objects is certainly not one of the defining criteria and Ruby for example happily let's you add methods to integers (both as a global monkey patch or locally via a refinement, which is probably closer to what Go achieves through type aliasing).

Hey Michael, I am not comparing primitive types and objects. I am saying object was designed to have a state and keep it. Struct is not. That's a huge difference. Go is suppose to be mainly stateless and work based on impulses, communication. input/output. Thx for reading!

code of conduct - report abuse