Interviews: Ask Alan Donovan and Brian Kernighan About Programming and Go
Alan Donovan is a member of Google’s Go team in New York and holds computer science degrees
from Cambridge and MIT. Since 2005, he has worked at Google on infrastructure projects and was the co-designer of its proprietary build system, Blaze. Brian Kernighan is a professor in the Computer Science Department at Princeton University. He was a member of technical staff in the Computing Science Research Center at Bell Labs, where he worked on languages and tools for Unix. He is the co-author of several books, including The C Programming Language, and The Practice of Programming. Recently, the pair have co-authored a soon to be released book titled The Go Programming Language. Alan and Brian have agreed to give us some of their time to answer any questions you may have about the upcoming book, Go, and programming in general. Ask as many questions as you'd like, but please keep them to one per post.
Hi, I've stopped using Go when I saw the hacky stuff I need to do to get libraries like OpenGL to behave correctly. (see https://github.com/golang/go/wiki/LockOSThread) Are there any plans to fix this?
There's already a game called Go, which has about a gazillion articles on how to program it. Couldn't you come up with a name that would be less ambiguous? Now, when you see a user group for "Go programming", you have no clue which one it is.
Support microSD: in a post 9/11 world, it is unwise to carry your data on media that you cannot comfortably swallow.
Why the hell would anyone use Go?
(Serious question, since our editors didn't tell us why Go was created, what Go's intended purpose was and whether or not anyone is actually using Go.)
How does 'The Go Programming Language' compare to 'The C Programming Language'?
Why was package versioning left out? And are you guys still fond of this decision? As I use Go more and more I see this to be the weak spot; software has been around for many decades, and we all know that it is continuous evolution. Go's import system does not allow specifying or hinting a version, nor does the `go get` command (although it supports major VCSes), and that's how hacks like gopkg.in have been conceived. And it's not like package managers for other languages haven't already solved in a more or less elegant way the problem already...
Go language differs from many other languages in how it handles Errors. Can you summarize the benefits and drawbacks to the Go language error handling approach when compared to Java for large scale applications.
Seeing as how it was created after the Internet was big, and one is constantly searching the Internet about the programming language one using, wouldn't you want a distinct name so search results are what the programmer wants? "Go" is the 35th most common word in the English language. When you search for "go" you get entries about games, movies, etc. Google, coincidentally gives the best results if the programming language is what you are searching for, but even Google gives you results for all sorts of things. The programming language isn't even a dominant result on other search engines.
Obviously, if you use a search engine to find things about "JavaScript" or "Erlang" you get what you want. I can't imagine going through the trouble of creating a programming language and then failing to give it a distinctive name.
Democracy Now! - your daily, uncensored, corporate-free
For what scenarios and projects do You recommend it and for which you recommend against using Go?
Moderating "-1, Disagree" is simple censorship. Have the guts to post your opinion. -- Spazmania (174582)
I can understand the convenience of not needing to mark a class as an implementer of an interface. But on the other hand, it would be nice if you at least had the option of marking a class as an implementer of an interface, so your IDE could tell you your class is not complete.
Democracy Now! - your daily, uncensored, corporate-free
What serious long-term real-world potential do you see for Go?
How do you see the potential of Go replacing existing open source webstacks such as Apache and PHP, Python or Ruby? Was Go built with a technology update of existing approaches in mind? How feasible is it in your opinion to try and replace the existing complex stacks with pure Go runtimes?
We suffer more in our imagination than in reality. - Seneca
Is there an official cross-plattform Go IDE in the works? Experience shows that adoption is accelerated by offering a solid toolkit that is easy to pick up and get started with - such as the formidable Android Studio IDE Google offers to developers. Are there any plans similar to this for Go?
I would like to see it take the place of C++ in the development of performant end-user applications with GUIs - are there any officially sanctioned projects that aim to provide a serious GUI toolkit and stack based on Go?
We suffer more in our imagination than in reality. - Seneca
There many books on "how to program" but few on "how to program well". Brian, your book "The Elements of Programming Style" is a wonderful and a classic, but my students have a hard time reading the examples (Fortran 66 and PL/I).
Is there any hope for an update?
Is there any similar modern-language book that you recommend?
Michael Nahas (son of Joe Nahas)
P.S. I totally stole as much as I could from you when writing my tutorial for the language Coq. Sorry/Thanks!
I though this was funny "He is the co-author of several books, including The C Programming Language, Second Edition" Like somebody else co-wrote the first edition?
The main feature in Go is channels and the light weight threads you can use with them (goroutines). Go is for writing a certain style of concurrent program, and it does not intend to rival Common Lisp in language features. (I'd take ML over Lisp, I think the type inference in ML is a pleasure to use compared to Lisp)
“Common sense is not so common.” — Voltaire
As the legend has it, C was created to support operating system development. As time has gone by C++ has slipped into OS development on larger platforms. It seems that much of the current core use of mother C is centering on embedded processors (all the way down to 8 bit micros with 256 bytes of RAM) and drivers in larger systems. For current use what design choices in C do you see as wise and what would you change given the current usage of C.
PS: Thanks you for co-authoring the most wonderful, perfect, clear and concise technology document ever.
Come on, be honest!
Copyright (c) 1990 - 2014 Dice. All rights reserved. Use of this comment is subject to certain Terms and Conditions.
Comment removed based on user account deletion
C has a lot going for it. It's simple, portable, ubiquitous. The language lets you do whatever you want with minimal fuss or overhead. Its generated assembly code is fast and efficient. Because it's the system language of choice for operating systems, nearly every other language can interop with C to some degree. C++ is largely backwards compatible with it. If you want a library to be portable with just about everything else, you write it in C. Great.. awesome so far.
That being said, C requires that the programmer write code perfectly, or else you've got a potential security disaster. It's not theoretically impossible, but as we've seen from history, in a large body of complex code, it's nearly impossible. There are virtually no built-in mechanisms for the compiler to help the programmer catch obvious programming errors. As such, it seems like a rather terrible language to use for any sort of internet-facing API, where the code will be subjected to intense attacks. And that pretty much describes most of Google, doesn't it? So it's not too surprising Google would be looking for a safer C-like alternative.
C is a fine language for what it is, but I don't understand people that seem to pick a single language, then infer that it's the end-all and be-all for every programming task on the planet. You CAN write secure, threaded code in C. Then again, you CAN build an entire house with nothing but hand tools. No carpenter doesn't have a basic hammer in their toolbox, but I'd imagine very few would purposefully eschew the use of a nail gun when appropriate.
Irony: Agile development has too much intertia to be abandoned now.
If your program runs on a machine which is connected to a network then it's an attack vector, even if it doesn't directly offer network services. Look at the huge number of vulnerabilities in things like file viewers or graphics rendering libraries.
Sure, if you're writing an application which you know will only ever be run on airgapped machines with no removable storage then maybe you can not worry about security. Those applications are few and far between.
---- Den ene knappen er powerknapp, den andre er Bender voice knapp "Bite My Shiny Metal Ass"
Why aren't you writing in assembler? Actually scrub that - how's your microcode? What always amuses me about the bare metal brigade is that they're often not actually that close to the metal.
Different levels of abstraction work for different tasks, and it's always a trade off. Security vs Reliability vs Performance vs Resource Usage vs Developer Time vs Maintainability vs ... you get the picture. Anyone who tells me their tool of choice is appropriate for all tasks is telling me they have a very restricted view of the world. I write mainly in Scala these days but there are plenty of things I wouldn't try to use it for, and I sure as hell wouldn't write my services in C!
---- Den ene knappen er powerknapp, den andre er Bender voice knapp "Bite My Shiny Metal Ass"
Java is LICENSED by Oracle who doesn't give out the source code... Go is BSD licensed and has source code so you can build your own copy.
Check with Oracle about the terms they use if you want to distribute their Java Virtual Machine in a commercial product. I can assure you it involves you providing them with cash before they will let you even distribute Java, unmodified, as part of your product. I know this from experience. I'll warn you, Java from Oracle does NOT come cheap if you wish to distribute it. Sure they will let you and your customer download it for free, but they want their cut if you download and distribute Java to a customer.
With Go, there will be no such restriction. You can build and distribute Go to your hearts content w/o paying anybody even if you charge for it. You can embed Go in a project, modify it and sell it without having to give up your source code (as I read the license) as long as you leave the BSD license alone.
"File to fit, pound to insert, paint to match" - Aircraft Maintenance 101
I'm curious as to the design decisions that led to the way that Go objects are implemented, which feel and seem to operate like C structs w/ function pointers. Yes, all objects are essentially structs with function pointers, but most languages provide a good deal of syntactic and functional candy on top of them to make them more useful. With Go objects, you get sortof-inheritance, sortof-polymorphism, and sortof-encapsulation, which requires re-thinking a lot of design patterns that people learn working with languages like C++, Java, and even PHP. That's not necessarily a bad thing, I can see arguments for forcing people to get out of their comfortable patterns, I'd just like to know why.
Could the GoLang team produce a walkthrough on enhancing the compiler?
Even something as simple as making the code more idiomatic (since it was translated) could garner huge increases in contributions.
A guide to the structure would also be helpful.
Science & open-source build trust from peer review. Learn systems you can trust.
These statements come from experiences in other languages with obnoxious GCs. This is a performance-focussed language with great multiprocess primitives. The GC causes far less latency.
https://talks.golang.org/2015/...
Pauses average 1ms and will be halved again next release to 1/2000 of a second which is plenty workable for games & audio mixers
Further, intelligently-written code can massively reduce GC frequency.
A certain high-throughput web service I've built runs GC roughly once per hour (yet services 1000s of concurrent requests). And this is without any serious effort at tuning. This is because (unlike Java, Python, and JS) GC is avoided if possible for stack space (whenever provably-safe) which is freed when it leaves scope. The proving algorithms are improving too.
Science & open-source build trust from peer review. Learn systems you can trust.
Now that Go has been in the wild for some time, which parts of the language would you change, and which bits have been an unexpected success?
Are there any plans for Golang version 2, and what might that include?
Check with Oracle about the terms they use if you want to distribute their Java Virtual Machine in a commercial product. I can assure you it involves you providing them with cash before they will let you even distribute Java, unmodified, as part of your product. I know this from experience. I'll warn you, Java from Oracle does NOT come cheap if you wish to distribute it. Sure they will let you and your customer download it for free, but they want their cut if you download and distribute Java to a customer.
OK, I checked with Oracle, and they said this:
Can I distribute Java with my software?
Yes, you can provide Java with your software provided you abide by the terms and conditions of Java binary code license.
Go is great, and there are definitely advantages to Go's BSD licensing model, but this is not one of them :)
Need to type accents and special characters in Windows? Use FrKeys
Sure, here's one from Russ Cox: https://news.ycombinator.com/i... Ultimately, those criticisms are not very interesting, because as a Go programmer these are tools you use as an end-user, not something which dictates how you program, and can and will be improved behind the scenes.
You need to read the "Binary Code License Agreement" because that's where the terms are set. So YEA, you can distribute it, but if you distribute the "commercial features" (and my product does) you need a separate license. They charge for that license.
"File to fit, pound to insert, paint to match" - Aircraft Maintenance 101