Linked by Thom Holwerda on Wed 11th Nov 2009 14:21 UTC
Google Google has invented a new programming language designed to reduce the complexity of coding without compromising the performance of applications. Called Go, the language has been tested internally at Google but is still at an experimental stage, so the company is releasing it as open-source code in the hope that it will get help with its future development.
Thread beginning with comment 394029
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[3]: Dirty?
by ndrw on Wed 11th Nov 2009 16:54 UTC in reply to "RE[2]: Dirty?"
Member since:

It uses interfaces to describe capabilities (i.e. duck typing), not a rigid class hierarchy. With no restrictions on what you can attach methods to, it is much more flexible and simpler mechanism than subclassing. "Subclassing" is still available through type embedding, btw. Whenever you embed other types, you automatically "inherit" their interfaces and implementations (of course, you can redefine some of their methods if you choose so).

Reply Parent Score: 1

RE[4]: Dirty?
by drstorm on Wed 11th Nov 2009 22:19 in reply to "RE[3]: Dirty?"
drstorm Member since:

OK. That is Prototype-based programming which is a kind of OO, but I don't see how is that more object-oriented than Java. Is JavaScript more OO than Java?

Unlike Go, in Java everything is an object and although you could write a procedural Java code by putting everything in one static class, all those "static" keywords scream that you are doing it wrong.

In Go, however, you can write very C-like procedural programs without even knowing that you can make objects.

The point is, I still don't know how Go can be considered more OO. In fact I argue that it is, in fact, just the opposite.

Reply Parent Score: 4

RE[5]: Dirty?
by google_ninja on Thu 12th Nov 2009 01:46 in reply to "RE[4]: Dirty?"
google_ninja Member since:

OO is (mostly) about leveraging polymorphism to create flexible code. Inheritance based polymorphism is probably the most tightly coupled and rigid form of polymorphism.

It's not something you really get until you fully implement something in a language that is not class oriented the way that most of the c++-ish systems languages are. Really grokking something like ruby or smalltalk will totally change the way you look at these things.

Also, dynamic dispatch + duck typing does not nessicarily mean prototypal. For example, ruby is a strongly typed language where objects can (and often do) vary from their type. In js, you can do
"" = new function() { .. }
that will add foo to all instances of string. in ruby, attaching a method to the string class is one option, another is to attach it to the instance, like

s = ""
end # calls method
"".foo # method not found, only exists on s

Anyways, all that to say that while prototypal programming is one way to do this sort of thing, doesn't mean there aren't others.

Reply Parent Score: 2

RE[5]: Dirty?
by ndrw on Thu 12th Nov 2009 03:33 in reply to "RE[4]: Dirty?"
ndrw Member since:

Java's OO semantics have deficiencies that Go solves. To me it is equivalent to "Go can be considered more OO".

It doesn't mean that Java is bad - it's actually my favorite system-level language. But that's mostly because of its robust frameworks and the fact I've learned to live with its limitations.

The Java OO deficiencies (those that matter to me) are:
- non-OO primitive types,
- no multi class inheritance (for a good reason - it can get messy very quickly),
- limited interfaces (the only way to implement an interface is to write it by hand or inherit it from a (single!) base class).

Go simply doesn't have these limitations.

I agree with you that one can write procedural programs in Go (and Java, C++,...). However, this doesn't make the language non-OO, it's just user's choice not to use these capabilities.

Sorry about my comments regarding the Go syntax issues. I just can't help thinking that even a bad syntax (which it isn't) is at worst a nuisance.

Reply Parent Score: 1