The Short But Sweet History Of The Go Programming Language
The History of Computing - Een podcast door Charles Edge
Categorieën:
The Go Programming Language Go is an open-source programming language with influences from Limbo, C, APL, Modular, Oberon, Pascal, Alex, Erlang, and most importantly, C. While relatively young compared to many languages, there are over 365,000 repositories of Go projects on Github alone. There are a few reason it gained popularity so quickly: it’s fast and efficient in the right hands, simple to pick up, doesn’t have some of the baggage of some more mature languages, and the name Ken Thompson. The seamless way we can make calls from Go into C and the fact that Ken Thompson was one of the parties responsible for C, makes it seem in part like a modern web enabled language that can stretch between the tasks C is still used for all the way to playing fart sounds in an app. And it didn’t hurt that co-author Rob Pike had whelped write books, co-created UTF-8, and was part of the distributed operating system Plan 9 team at Bell Labs and had worked on the Limbo programming language there. And Robert Griesemer was another co-author. He’d begun his career studying under Niklaus Wirth, the greater of Pascal, Modula, and Oberon. So it’s no surprise that he’d go on to write compilers and design languages. Before go, he’d worked on the V8 JavaScript engine at Google and a compiler for the Java HotSpot Virtual Machine. So our intrepid heroes assembled (pun intended) at Google in 2009. But why? Friends don’t let friends write in C. Thompson had done something amazing for the world with C. But that was going on 50 years ago. And others had picked up the mantle with C++. But there were shortcomings the team wanted to address. And so Go has the ability to concatenate string variables without using a preprocessor, has many similarities to languages like BASIC from the Limbo influences, but the most impressive feature about this programming language is its support for concurrent execution. And probably the best garbage collection facility I’ve ever seen. The first version of the language wasn't released to the public and wouldn’t be for a few years. The initial compiler was written in C but over time they got to where it can be self-hosted, which is to say that Go is compiled in Go. Go is a compiled language that can run on a command line, in a browser, on the server, or even be used to compile itself. Go compiles fast and has no global variables to clutter memory. This simplicity makes it easy to read through Go code line by line without consulting any parsing tools or syntax charts. Let’s look at a quick Hello World: // A basic Go program that demonstrates "Hello World!" package main import "fmt" func main() { fmt.Println("Hello World!") } The output would be a simple Hello World! Fairly straight forward but the power gets into more of the scripting structures - especially given that a micro service is just a lot of little functional scripts. The language itself has no connection to any other functional programming languages and does not include support for object orientation or reflection. The language consists of two parts: a parser (which processes an input file) and a bytecode interpreter, which translates all source code into machine code. Consequently, Go programs tend to compile quickly and run very efficiently because they are mainly independent of the runtime environment and can execute directly on the hardware without being interpreted by some sort of virtual machine first. Additionally, there is no need for a separate interpreter during execution since everything runs natively. The libraries and sources built using the Go programming language provide developers with a straightforward, safe, and extensibility system to build on. We have things like Go Kit, GORM, cli, Vegeta, fuzzy, Authboss, Image, Time, gg, and mgo. These can basically provide pre-built functions and APIs to hook into any old type of service or give a number of things for free. Go was well designed from the outset and while it’s evolved over the years, it hasn’t changed as much as many other languages. with the latest release being Go 1.17. 1.1 came just a couple of months after the initial release to increase how much memory could be used on 64 bit chips by about 10-fold, add detection for race conditions, added the uint for 64 bit integers. Oh and fixed a couple of issues in the compiler. 1.2 also came in 2013 and tweaked how slicing of arrays worked in a really elegant way (almost ruby-like) and allowed developers to call the runtime scheduler for non-inline calls. And added a thread limit, like the ulimit a bash would have, for 10,000 threads. And they doubled the grouting minimum size of the stack. Then the changes got smaller. This happens as every language gets more popular. The more people use it, the more havoc the developers cause when they make breaking changes. Bigger changes are contiguous models of grouting stacks in 1.3, the addition of internal packages in 1.4, a redesigned garbage collector in 1.5 when Go was moved away from C and implemented solely in Go and assembler. And 17 releases later, it’s more popular than ever. While C remains the most popular language today, Go is hovering in the top 10. Imagine, one day saying let’s build a better language for concurrent programming. And then viola; hundreds of thousands of people are using it.