I just read through the language spec and memory model for Go, Google's new language (thank you for the link Scott.) There are a lot of things l like about the language, such as its approach to concurrency, heavy use of type inference (which we also see in C# and Java 7), ruby-like array and map manipulation syntax, etc., but I'm not entirely sold on the type system. Go has no concept of inheritance, which they cite as a good thing because Go types are "light". From the Go docs:Rather than requiring the programmer to declare ahead of time that two types are related, in Go a type automatically satisfies any interface that specifies a subset of its methods. Besides reducing the bookkeeping, this approach has real advantages. Types can satisfy many interfaces at once, without the complexities of traditional multiple inheritance. Interfaces can be very lightweight—having one or even zero methods in an interface can express useful concepts. Interfaces can be added after the fact if a new idea comes along or for testing—without annotating the original types. Because there are no explicit relationships between types and interfaces, there is no type hierarchy to manage or discuss.Um... OK, so you have this sort of loosey-goosey approach to interfaces (if I have the methods, I satisfy the interface), but what about super class constructors and concrete (non-abstract) methods? I'm having trouble imagining libraries such as UI toolkits (WPF, Flex, Swing, etc.), which effectively make heavy use of relatively deep inheritance trees, being written in as elegant a manner in Go. Those super classes are doing a lot of work, and the type hierarchies provide a nice taxonomy for the API. Perhaps Go is advocating the use of a different paradigm to accomplish the same thing, but it doesn't seem to be readily evident from the docs.
Tags: go, google go, programming language
Comment
Tim Dysinger: I program my scheme in lisp. I program my editor in lisp (elisp). I program my java in lisp (clojure). I program my erlang in lisp (LFE).This sounds like a great talk for one of the local coder groups.
There is state strewn everywhere in OO apps and shared-state threading tools in OO rely on locks to make sure you don't have threads clobbering each other's shared state. It's very difficult for the average programmer not to hang him/herself.True. Concurrent programming is hard, and Java's approach certainly has its drawbacks.
To me this is Java and C# and co are antiquated and why I don't code in OO langs anymore very much.I think we will have to agree to disagree on this. Thats OK - forums are boring if everyone agrees :-) I think OO solves a lot of problems very elegantly. It really depends on the domain.
argh no prevews before postsI agree - this is annoying. Hopefully it will be rectified soon.
colors := new(Set<Color>);
m := map[string]int{"one":1 , "two":2}
, but you can't define your own generic types (types that have type parameters.)Generics may well be added at some point. We don't feel an urgency for them, although we understand some programmers do. Generics are convenient but they come at a cost in complexity in the type system and run-time... (clip) ...This remains an open issue.
© 2010 Created by Daniel Leuck
You need to be a member of TechHui to add comments!
Join TechHui