This is actually the first proper stable release since the process was introduced, the first tagged release did not go through a similar release preparation.
I'm personally extremely happy with this development. We run Tinkercad on a moderately complex Go/C++ based server infrastructure (7 server types on tens of machines) and we have been lagging the Go tip given our need to avoid instability. The fact that we can now sync more often than 6 months and with less risk is great. It's a important step towards making Go a solid choice for distributed systems programming.
Bold, delicious digression from oop - there literally is no relation between objects by identity, only by behaviour via interfaces - not your usual crappy java/c#/etc. interfaces, but rather 'true' interfaces, which are implicitly implemented by dint of a type fulfilling them. This is surprisingly powerful and the simplicity of it helps move you away from thinking about complexities you get with oop that have nothing to do with the problem at hand.
Extremely fast compiles - you miss this when you go back to languages that compile more slowly. It allows for rapid prototyping and trying stuff out without having to worry about a massive build time. Check out this vid - [1].
Great concurrency support - concurrency is primitive in go via go-routines.
Sensible, simple, clean syntax.
The list goes on... yeah I need to do a blog post here :)
> extremely fast compiles - you miss this when you go back to languages that compile more slowly. It allows for rapid prototyping and trying stuff out without having to worry about a massive build time.
You're paying a price for this speed: the Go compiler is single pass, which considerably cripples the language and imposes a lot of weird asymmetric features.
And the compilation difference is really still in the ballpark of Java or C#, so it should definitely not be a factor in your decision. Odd that it was a design goal for Pike and his team, but everything is Go seems to indicate that the last language they programmed seriously in was C++ in the late 90's.
> You're paying a price for this speed: the Go compiler is single pass, which considerably cripples the language and imposes a lot of weird asymmetric features.
That's just not true - go is not single pass (as I understand it). There are separate passes performed for top-level types and code blocks, for example, and you can forward reference all you like.
Actually, I've made a couple contributions to the language so have played with the internal implementation, and in fact the parse is done in one pass, setting up internal representations of the types/names/etc. before type-checking of top-level types is performed in a separate pass, then variable assignments, then function bodies. I can't see how this is single-pass, e.g. src/cmd/gc/lex.c:238:-
// Process top-level declarations in three phases.
// Phase 1: const, type, and names and types of funcs.
// This will gather all the information about types
// and methods but doesn't depend on any of it.
// Phase 2: Variable assignments.
// To check interface assignments, depends on phase 1.
// Phase 3: Function bodies.
defercheckwidth();
for(l=xtop; l; l=l->next)
if(l->n->op != ODCL && l->n->op != OAS)
typecheck(&l->n, Etop);
for(l=xtop; l; l=l->next)
if(l->n->op == ODCL || l->n->op == OAS)
typecheck(&l->n, Etop);
resumetypecopy();
resumecheckwidth();
for(l=xtop; l; l=l->next)
if(l->n->op == ODCLFUNC)
funccompile(l->n, 0);
if(nerrors == 0)
fninit(xtop);
while(closures) {
l = closures;
closures = nil;
for(; l; l=l->next)
funccompile(l->n, 1);
}
dclchecks();
Unless I'm missing the point - what is crippled and where are the weird asymmetric features?
One thing that go avoids is weird syntactic conflicts which require big lexer/parser hacks to work around. C# has quite a few of those, e.g. Foo<Bar<Baz>>> - that's emphatically not the same thing as a single-pass compiler.
Actually Rob has talked about this[1] and highlights dependency management as the most important factor.
I use C# in my day job and find the go compiler considerably quicker, incidentally.
> the Go compiler is single pass, which considerably cripples the language and imposes a lot of weird asymmetric features.
What evidence do you have that it cripples the language? And can you point to a single 'asymmetric feature' (whatever that means) caused by this?
If you read any of the interviews with Rob, he clearly points out that the compile speed has little to do with it being 'single pass', and all to do with the package system.
In my subjective experience the compiler is way faster than Java or C# compilers, and they still have plenty of room to optimize compiler speed (for example, there is plenty of stuff the compiler could do in parallel but at the moment doesn't because they have tried to keep the toolchain as simple as possible specially while the language is changing so fast.)
> Bold, delicious digression from oop - there literally is no relation between objects by identity, only by behaviour via interfaces - not your usual crappy java/c#/etc. interfaces, but rather 'true' interfaces, which are implicitly implemented by dint of a type fulfilling them. This is surprisingly powerful and the simplicity of it helps move you away from thinking about complexities you get with oop that have nothing to do with the problem at hand.
I'm not sure if what Go is doing is "Duck Typing", but there's a huge difference from Python.
In Go, something implements an Interface by virtue of having the right method. No "implements" declaration is necessary. This is statically typed and safe at compile time, while Python is not.
Does anyone know what this feature/pattern is called? As far as I know, Go is the first language to have this feature. Seems different from "Duck Typing" to me..
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.
You're exactly describing duck typing. Resolving it at compile time in a static, "safe" way is a useful feature to be sure, but that doesn't mean it's not duck typing.
Replace "Go" with "Python" in your final paragraph and it's just as true.
Implement __setitem__(key, value) and you can use it in a dict-like way such that you can say "foo[bar] = baz" where foo is an object of your defined type. Define __iter__ on your type and you can now say "for x in foo: ..."
It's a more restricted version of duck typing and requires an interface specifically to be set up for the type, though not for the type to explicitly implement it, so it's not quite the same thing.
The alternative is the way C++ was handled--for a very long time new stuff would be added to compilers in a non-backwards way and break all your code. This was happening pretty much every time you got a compiler update and was very frustrating. "gofix" seems like a pretty good compromise for using the language while it's developing and not having your code break constantly.
While the Go language is still under development you will run into problems from syntax and API changes. I think the existence of the gofix command speaks more about the quality of the effort put into Go as a whole. They actually put in the effort to make syntax and API changes as easy to fix as possible.
If you look at the actual fixes gofix provides, most of them are to paper over a lack of language features. In particular, if Go supported function overloading, they probably wouldn't need gofix at all.
Am with the siblings - disagree very much. A very nice thing about go is that it isn't afraid to say 'no' to features, nor is it afraid to enforce conventions to encourage consistency.
I bet the coding standard discipline at google has something to do with it, as described by Steve Yegge[1]:-
"Google is an exceptionally disciplined company, from a software-engineering perspective. They take things like unit testing, design documents and code reviews more seriously than any other company I've even heard about. They work hard to keep their house in order at all times, and there are strict rules and guidelines in place that prevent engineers and teams from doing things their own way. The result: the whole code base looks the same, so switching teams and sharing code are both far easier than they are at other places."
It's pretty to make version one of your language's libraries clean and simple. The real challenge is how they hold up over time and the needs of evolution. Go's philosophy seems to be:
1. Simplicity matters more than compatibility.
2. Assume all extant Go code is easily mutable.
The purist in me finds that appealing, but I'm not sure how that will hold up over the long term. The language seems intentionally designed to not evolve which doesn't seem like a good way to stay useful for real people for a long time.
Maybe I'm wrong and everything will work out, but I wonder if several years from now, Go will just fall over from its inflexibility and become unusable.
You typically can't even compile Linux with the previous GCC version, yet somehow that kernel has been tottering along for about 20 years now.
If you compile a program using Go, you get a binary that will run forever. Statically linked, contains the runtime, you're all set. If you update Go, you can then re-build that same program, but you might have to update a few things to get a working binary again--but you only have to do this if, somehow, that originally-compiled binary isn't working for you.
If Python decides they want to change the syntax for opening a file, then you can either 1. Keep a second Python around forever for compatibility or 2. Modify your program so it uses the new syntax. Go will never do this to you; as long as your OS continues to support the same binary format, I don't see why a binary shouldn't work indefinitely.
I disagree. Even for the gofix fixes look to be simple "n args to n-1 args" changes, even in a language that supports function overloading I would prefer to have one version of the function, not two. The use of overloading to avoid the pain of an API change over time leads to a pretty crappy interface.
What's the appeal of Go when something like OCaml exists and seems to cover much of the same territory and delivers better performance? Not trolling here, I'm genuinely curious.
First of all, it is quite obvious that Go and OCaml are completely different languages designed around very different philosophies and styles.
Also saying that you are not trolling doesn't make your comment any less trollish, specially given that your only claim is false, Go, despite still being much younger and greatly unoptimized is already considerably faster than OCaml: http://shootout.alioth.debian.org/u64/benchmark.php?test=all...
I'm asking about technical merits of one over the other, which you didn't respond to at all. And look at the overall scores on the 64bit one-core and quad-core benchmarks. OCaml is ahead.
I'm looking at the overall scores on the 64-bit single-core and Go is six places ahead of OCaml. On the 64-bit quad, Go is five places ahead. The only one where OCaml appears to come close is single-core 32-bit, in which Go comes out one place ahead of OCaml.
(And just so we're clear: I actually like OCaml and have never used Go. So I'm not trying to wave some Go fanboy flag or anything. Those are just the numbers.)
Those tables do not show a rank # by each programming language implementation because that might encourage people to make a completely bogus comparison!
(For example, six places rather than five just because one table includes an extra programming language - Clean.)
You're both being silly! "The numbers" for Go 6g and OCaml overlap and are quite similar.
Half the responses were of the reasonable variety - "Not really much to say as far as technical merits - but it feels better to program in Go for me". Some brought up interesting similar projects. And others corrected my errors. Since when is sparking reasoned debate/discussion trolling?
You can learn to be useful in Go in about 5 minutes, and it has some extremely convenient support for concurrency.
On the flipside, I think learning OCaml (if you've no experience with that family) will make you smarter in a way that Go won't. Of the two, given someone that knew neither: if you want to learn something learn OCaml, if you want to do something use Go.
I have looked at Rust. Rust looks like it has the potential to be a much bigger game changer than Go in the systems programming space, in my humble opinion. But only time will tell.
Why do you think Rust has the potential to be a much bigger game changer than Go in the systems programming space? I assume you have technical reasons for this opinion?
OCaml delivers better performance? It was my impression that they're currently neck-and-neck, and the current Go compiler does pretty much no optimization.
That aside, personal preference is a one reason to choose Go over OCaml. I happen to like Go's syntax better, and I rather like the design of various bits of the language.
Go also has better concurrency support.
Also, for some tasks it can be quite useful to be able to control the memory layout of your data structures, and (to my knowledge) OCaml can't do that.
There are other points to make on both sides, but really, it's a tricky question. Which langauge is best is a per-task and per-person question, so unqualified comparisons aren't terribly useful.
There are two Go compilers gc and gccgo. gc is based on the Plan 9 C compilers and has very little optimisation; gccgo is a front-end to gcc and as such has all of its optimisation. gcc's concurrency support is thread-based so slower than gc's which is coroutine based.
You are comparing different things. OCaml strength is safety, it verifies at compile time that your program is safe, correct apart algorithmic errors. Once it compiles, you are almost sure it is going to work. Go does not give any such guarantee.
And among "safe" languages, OCaml is probably the most efficient, generating fast code running with a small memory footprint.
Moreover, although its development was a little slow in the last years, they have recently restarted working on it, on optimizations and soon multicore support, so I would wait a little before making more comparisons.
since we are comparing go and ocaml, why did they not add more functional programming support in go? It would at a lot of expressiveness to the language. Just wondering.
Call me crazy but it seems like Go is really just a munging-together of C and Limbo with a bunch of ideas from Python, and literally every feature that "supports functional programming" is only there as a result of being in Python. And obviously Python is not really designed to be a functional language....
If you think Python was a significant influence in Go's design you probably have not worked with much with Go or its ancestors.
Yes, Go is not a 'purely functional' language, or 'purely' anything, Go is a pragmatic language following from a very long tradition mostly at Bell Labs.
> If you think Python was a significant influence in Go's design you probably have not worked with much with Go or its ancestors.
You're correct. I haven't used Go particularly much and I've only heard third-party descriptions of Limbo et al. Regardless, a number of the semantic and syntactic differences between Limbo and Go strike me as Python-influenced (obviously not goroutines or the defer statement) but if you have evidence to the contrary I'd love to see it.
> Yes, Go is not a 'purely functional' language, or 'purely' anything
Whoa buddy. That's not what I meant at all. There's no technical value in being able to say your language "purely" implements some programming style or other. Now, it would be nice if higher-order functions became a little easier to work with in Go; it is also unlikely that this will happen, because that's not one of the design goals. I can't fault them for that, but is there really any harm in pointing out a true fact such as this one?
And anyway, a "purely functional" language is just one where there's no built-in support for mutable state. Obviously this does not describe either Go or OCaml.
http://planet5.cat-v.org/ is the closest, but haven't maintained it properly for a while, I should add a few new blogs and remove some that are obsolete.
I haven't used Go het, but try to keep up to date. One issue I have is that naming conventions seem all over the place. Is there a logic behind the naming of things?
For example, function names are sometimes CapitalizedLikeThis, but sometimesLikeThis. This kind of messy inattention to detail makes the language come across as sloppy and unfinished.
This is actually part of the language. Identifiers starting with a capital letter are exported outside the package, the ones with a lower case letter are not.
This is covered in the basic language introduction: names starting with a capital letter are public, names starting in lower case are private.
Go's naming conventions are much more clean, respected and even enforced than in almost any other language I know (Ruby and Python are specially bad in this, but C++ and Java are not much better).
Go's naming conventions are much more clean, respected and even enforced than in almost any other language I know (Ruby and Python are specially bad in this, but C++ and Java are not much better).
Do you mind explaining this statement a little further, specifically related to Python and Ruby. I work with both of those languages and find the naming conventions to be quite clean and respected. The style of the language is not enforced, but you'll certainly be chastised by any serious developer in either language for doing something outside the norm.
The Python stdlib is full of examples of CamelCase, under_score and alltogether.
In Ruby just looking at the methods for strings is enough to find this like: "instance_variable_defined?", "rindex", "tr_s", "casecmp", "equal?", "eql?" and more. Yes, it is all lower case, but consistent it is certainly not.
I also find myself wishing that Ruby's destructive (!) and boolean (?) suffixes were either enforced somehow or not used at all.
The idea itself is cool, communicating extra context about what the method does or its intended usage, but they're used so inconsistently (even withing the Ruby stdlib) that A) They're unreliable and you need to check the source to find out the behavior anyway and B) It's less predictable whether the method exists with the suffix or without, so you need to either run it and modify your method call if there's an error or check the lib/API docs. This is the sort of thing that makes having an IDE handy for completing method names, which is unfortunate because Ruby is generally very usable without any IDE crutches.
It goes from being mere syntax (like Ruby's elegant use of '@' to denote instance variables) to screwing with the names themselves apparently just to avoid introducing keyword (like Java's 'public') or additional syntax for exporting symbols.
Like the other commenter said: Functions/Fields in structs that start with a capital letter are visible to other packages. Functions starting with lower case letters are like C static and fields are (package) private.
I'm not perfectly happy with this convention because I prefer the everything_lower_case_with_underscores style but you get used to it. Go's benefits out weight its awkward quirks by far.
Go replaced python for me. Today morning for example I wrote a utility/demon that controls my Macbook Pros's Fan under Linux (because out of the box the fan stays @ 2000rpm till somewhere around ~80C).
I've also written 2 smaller web apps using Go and I had really fun doing so. Statically typed language for webdev = <3
I can say I became a Go fanboy in the last few weeks and I hope Go gets more traction. Go @ Android would be freaking awesome.
There's something (possibly irrational) in me that has a deep aversion against Java. Maybe it's from my job as game developer for J2ME devices back in 2003. Java is to me 90% boiler plate 10% actual app logic.
> Scala
Burn me on a stake but I'm not that into FP. Though I didn't look too much into Scala - maybe I missed a lot.
> C++
I've been using C++ a lot for game development and other "serious" stuff. I don't love it. I don't like the OO model. (I tend to not like OO nowadays at all.)
> Go made you arrive at this conclusion
It's not that I arrived at this conclusion lately. I always favored static typed languages - but for a quick hack there wasn't anything that could beat ruby/python (at least nothing I know about). Go maybe doesn't beat them too but getting a webapp running with Go isn't too much effort either. I can live with that. And my hate for python's whitespace madness and Ruby's 1000 ways of saying one thing made the decision to try out Go for web dev easier :)
This is pure guesswork (I am not he) but given that he's happy with go, perhaps he likes the style of programming that go promotes? It's not OO, it's not FP. More like evolved procedural programming, I guess.
Go falls under the broader OO set. OO isn't C++/Java, OO is an ill-defined collection of techniques that centers on binding data structures and methods to manipulate those structures tightly together. (Any other criterion I've ever thought of has a language that doesn't meet it, yet is generally agreed to be OO; that is literally as tight as I can make a broad definition of OO. You can't even get too specific on the nature of the "binding", and yes, my definition permits C code that is structured in certain manners to be "OO". I don't have a problem with that.) Python, Javascript, Go, and Java are all "OO", despite a wide variety of significant differences.
I can say I became a Go fanboy in the last few weeks
Go looked to me like a c-language guy's take on very simple OO with a few functional and parallel features. On the whole the API looked terse to the point of being cryptic, which is a throwback to the 1980s.
Can you sell it to me? What's the best part? Is it something that's not in any other language, or some way that the parts combine?
Many other languages have loose, duck typing and a few others (notably erlang) have the lightweight parallelism.
yeah I noticed him on the team. The core team has some amazing people on it, including famous people Rob Pike (Bell Labs unix/plan 9 guy) and Brad. I think that's a good sign that google are quite ambitious about the language :)
Back in February on the dev list Rob said something about "...until the App Engine stuff is out." For some reason this email doesn't appear in the archive, but I'm definitely looking at it in my inbox right now.
I'm personally extremely happy with this development. We run Tinkercad on a moderately complex Go/C++ based server infrastructure (7 server types on tens of machines) and we have been lagging the Go tip given our need to avoid instability. The fact that we can now sync more often than 6 months and with less risk is great. It's a important step towards making Go a solid choice for distributed systems programming.