The State of Go
talks.golang.org
talks.golang.org
m := map[Point]string{
Point{29.935523, 52.891566}: "Persepolis",
Point{-25.352594, 131.034361}: "Uluru",
Point{37.422455, -122.084306}: "Googleplex",
}
may now be written as: m := map[Point]string{
{29.935523, 52.891566}: "Persepolis",
{-25.352594, 131.034361}: "Uluru",
{37.422455, -122.084306}: "Googleplex",
}Still, 4ad's comment above mine changed my mind. I didn't consider that you can do this with structs already (in spite of the fact that I already do that in my code), and I prefer the consistency to the lack of verbosity.
map[Point]string
as opposed to something more symmetrical? func doSomething(input string) string { ... }
The go map declaration syntax is analogous to the function declaration syntax: the keyword (map, analogous to the func keyword) followed by the type of the keys in brackets (analogous to the argument type in parentheses) followed by the type of the values (analogous to the return type).Now I wish I had 1 million dollars and a better brain to work full time on a proper language that would fix go's issues. What a missed opportunity to create something everybody would be comfortable with. It could have been the biggest language of the next 20 years in webdev, CSP is a great concurrency model. At least it will inspire some people in the future I hope. Rust is cool but doesn't have CSP builtin.
Not possible.
I'm really a go tinkerer, but I like the langauge.
I didn't realize Garbage Collection was so expensive that the goal is to only have it run 20% of the time. But its a good goal.
"Run Go application code for at least 40ms out of every 50ms."
How does this work? As far as I understand Go is moving to a copying collector, so any pointers passed to C may become wild pointers when garbage collection is performed.
On go-nuts, Go's developers have been warning that passing arrays to C by getting the address of the first element of the slice will be unsafe for this reason.
I wonder, does this make stuff like this unsafe:
var thing C.thing; C.somefunc(&thing)
i.e. can stack address change now?
Create memory in Go-land
Use memory in C-land
Dispose of reference to memory in Go-land
That becomes a bit problematic if the C-land use is for a long-running process - you need a go object that owns the memory that has a lifetime that (at least) matches the lifetime of the C code execution.To make things work, you have to allocate date used in C in C and pass Go variables only by value.
it's hard. mixing manual and automatic memory management is tricky.
After all, a go executable can be 2x - 8x slower than a C one (which is still good enough for many uses).
Since a large project like Golang has so many auto-build tools and test OSes, how hard is it to provide a binary download for e.g. Ubuntu 14.04 LTS? You know, not tarballs, but actual static binaries as deb packages installable via apt-get.
Good examples:
https://www.percona.com/doc/percona-server/5.6/installation/...
I root for open source movement, but to install something on a popular arch/OS by compiling from source everytime is just meaningless power consumption and adding CO2 emissions.
If you really want to install Go via your package manager, you can install the golang package from the Ubuntu repositories. However, this package is naturally on an outdated version of Go. Also worth mentioning is godeb[1] which can generate and install a .deb of any version of Go for you.
[1]: http://blog.labix.org/2013/06/15/in-flight-deb-packages-of-g...
That's exactly the problems package would solve, well, plus easy update capabilities.
That being said, I had no problem installing go on my ubuntu, despite the fact that I consider that the installation process sucks.
$ tar -C /usr/local -xzf go1.4.2.linux-amd64.tar.gz
$ echo "PATH=$PATH:/usr/local/go/bin" >> /etc/profile
That's it, it is that simple. All you have to do now is set your $GOPATH, and you would need to do that even if you had installed Go through a package.
Don't most people want to install X via their package manager?
> However, this package is naturally on an outdated version of Go
I can't tell if you're being sarcastic or not here - why would a package such as this be outdated?
Because of the way software is packaged in most Linux distributions. The upstream version is frozen in that particular release.
To be fair, they follow a slide about general performance, 4 slides after the GC slides.
And from the concurrent GC slide it looks (as one would expect) that the GC burns significantly more resources overall (it's not just longer wallclock), though it rarely completely stops the world anymore: on the right-hand side, where the old GC would burn 1 unit of CPU for 240ms (3 * 80ms), the new one burns half a unit of CPU for 900ms (plus a unit for 2ms), which mean it's using 452ms of CPU, close to twice as much as the old one. Though the application pauses significantly less (which is good for responsivity), that's CPU time it doesn't get to use anymore. The concurrent GC also "leaves off" more work for later, the left-hand side graphs show relatively low CGC use for the first 7s, followed by a spike and then much, much longer GC runs (though at progressively lower CPU%).
I don't know about others, but it was my expectation that overall performance would take quite a hit for GC-heavy applications in 1.5.
It's not really suspect. The benchmarks reflect execution speed. The new GC trades a little raw throughput for lower GC latency. So you would expect a GC-heavy benchmark to show the greatest speed loss. What matters for go users, though, is the behaviour of real programs. Real programs benefit from the reduced latency of the GC and other compiler optimisations we have made since 1.4. The outcome, in our measurements, is roughly equivalent performance for most programs but with significantly shorter GC pauses.
However, this will probably deprecate or diminish the RPC and code generation techniques for implementing plugin architectures.
I was lucky enough to be able to use Native Oberon back in the day.
(raises hand) The well-documented, portable, simple OS and toolchain written by people with no interest in subversion available online for free? Not quite an Ubuntu but more usable than most things people were proposing (eg microcontrollers with hand-written Forth lol). I also thought Modula-2 or Oberon might make a good target for high level languages such as ML or Haskell if we're doing end-to-end safety arguments: one's claims can build on the others.
Interop with existing libraries is certainly a worthy enough feature to add to the Go toolchain, and it's an optional feature, so ease of deployment is still a primary concern, but if you need DLLs, this is available.
I don't know the background on this choice, but I've spoken to a few Go shops that have complained about memory usage when running a bunch of different Go binaries on the same machine, so hopefully this will help there.
Personally, I find that kind of thinking to be a relic of the past when memory and disk space were expensive and compilation took a long time.
Sure, if you're running on a raspberry pi, a few megs here and there might actually matter... but even my phone has 2gigs of RAM and 32gigs of disk space.
The nature of the modern computer is that cpu speed has increased more than memory speed, so if your data doesn't fit into cache your cpu will be do nothing quickly.
Even with shared libraries, this phenomena has such an impact that the Linux kernel now has a memory de-duplication feature (mostly for VMs):
The size of the binary is completely irrelevant when considering if the code fits in the CPU cache. What's important is the size of code that actually executes. Dynamic linking changes nothing.
That's not at all surprising considering that with static linking, each package is also built only once.
OTOH, it does well with the culture of making a lot of small, specialized executables rather than a single, monolithic application.
My point was rather that a 3MB executable used to be "large" and now it's not, even if you have 100 of them.
I thought this day would never come.
I read in then news that iOS9 will use Swift in some internal apps/libraries too (major internal rewrites?).
It can be done, thus:
#cgo LDFLAGS: -Wl,-U,_iosmain,-U,_PopUpDialogBox
Any developer who wants to do this needs only to create these #cgo statements for whatever Cocoa API they want to use, and they become available from the Go context ..IIRC, Go can call any Objective-C code through cgo.
What the Go team is doing is providing the same level of access that C and C++ enjoy.
Which means that outside developing games or writing pure business logic, is all about JNI fun.
In fact, I really like using Go on iOS - the ease with which it can be done was astonishing!
> to support Go packages that want to use plugins, a new package will be added to the standard library: plugin. It will define a function and a type.
https://docs.google.com/document/d/1nr-TQHw_er6GOQRsF6T43GGh...
[EDIT] I looked at the commits and it looks like it's not in the works, at least on the main repo.
GoCon - Tokyo, Japan - June 21 http://gocon.connpass.com/event/14063/
GopherCon - Denver, Colorado - July 7-10 http://www.gophercon.com/
GolangUK - London, UK - August 21 http://www.golanguk.com/
GothamGo - New York, NY - October 2 http://gothamgo.com/
dotGo - Paris, France - November 9 http://www.dotgo.eu/
I know it's an open topic, and there's no true "one way", but I'm wondering how people here would handle this situation. And perhaps it's my Python-addled brain that's the problem, since GOPATH is kinda sorta like PYTHONPATH, maybe enough to confuse me.
I have a repo at github.com/user/repo. It consists of independent but related applications, most in Python, one in Go. The Go project would be rooted in a "service" subdirectory.
I feel like I'm really missing some critical piece of a Go workflow, because I could never get that to build reliably when I started adding external libraries as a dependancy. It seems like I'd have to put the project in github.com/user/repo/service/src/github.com/repo/service, which is what makes me think I don't understand what I'm talking about!
To bring this rambling lazyweb back on topic, I guess I was a little disappointed that vendoring/packaging wasn't mentioned in this state-of-Go talk. I was really hoping I could easily give Go another shot, but in the absence of that, anyone have a suggestion for my setup above?
Your Go "project" goes in $GOPATH/src, i.e. your git repo would be in $GOPATH/src/github.com/user/repo
If you have your main pkg in $REPO/service, then you can build like so: go build github.com/user/repo/service (this can be ran from anywhere as it uses $GOPATH)
If you need to add a dependency, use: go get github.com/.... and go get will add it to $GOPATH/src/ which you can then import.
Thanks!
Tell me more ...
As you know, generics won't appear before 2.0, if ever. It's fine if that's a nonstarter for you. Perhaps you'll like Rust instead. It needs a big community too.
Closest thing I've seen in a modern product is Azul Systems' Java processors with concurrent GC's. So, at least one company is benefiting from the old wisdom.
Xomb, Mesa/Cedar, Oberon, SPIN, Singularity were all written in GC enabled system programming languages.
Although given my Oberon knowledge, I would say that was more a consequence of D's GC implementation quality than anything else, right?
On Oberon and all the derived OS, the Kernel module was the only one where GC wasn't used, as it needed to be implemented somewhere.
All the other modules enjoyed access to an OS wide GC.
Additionally, they can do what PL/S and certain Ada's did where specific modules were transformed by the compiler differently based on their needs. One might have total safety, one no safety, one a GC'd runtime, one a non-GC runtime, and one no runtime at all. Still using the same language and tools for everything, albeit subsets in some modules with extra worries.
They also planned to attract C++ programmers, but they've basically been attracting dynamic language programmers instead. Why that was a surprise is beyond me--I can't imagine that anyone currently using C++ would be OK switching to a garbage collected language.
Rust on the other hand, is shaping up to be a C++ replacement.
Just because someone uses Node.js to build a hobby robot, doesn't mean that many people are using it for production embedded systems. If your systems has hard real time requirements, which many systems do (even many hobby robots), a stop the world garbage collector is out of the question.
Let's say you have a legged robot that depends on interpreting sensor feedback to keep from failing over. What happens to your balance when the garbage collector pauses your code for 10ms?
Sure you can do embedded development with the .NET micro framework because there are embedded systems that don't have hard real time requirements.
If you're building a hobby robot with netduino, you might not care if you have guarantees about input response time--as long as the delays are usually small enough. But if you move beyond that, you're most likely going to need a real time system.
http://www.atego.com/products/atego-perc-pico/
As a language I am not a fan of Go, but on the context of using strong type languages in embedded scenarios. I think the less C the better.
Just like JavaScript JITs, it is always a matter how much companies are willing to invest to improve the quality of the existing eco-systems.
So sure, if you want to use go syntax and build a completely new runtime designed for use in real time systems then go ahead.
As for strong typing in embedded scenarios Ada's been doing that for decades.
That seems like another variable to consider if you're in an environment where you have to somewhat control how much memory you use. But I don't know really know anything about the details of garbage collection, I just figured that that would be one of the trade-offs. So correct me if I'm wrong.
[1] Or whatever technique is used
Here's a quote from the announcement talk
"And it's a systems language in the sense that we intend it to be used to write things like web servers"
How modern is modern CS?
I took my CS degree around 20 years ago with focus on computer architecture, compiler design and distributed systems.
Distributed systems literature used in the degree went back to the early UNIX days.
The creators of Go were on the team that built UNIX, and they clearly have a different meaning for the word systems.
They were using it to refer to infrastructure, without making a distinction whether it was distributed or local. Something like a compiler would be "systems" program under this definition.
I agree that distributed systems, and systems programming are generally accepted terms of the art in CS now, and even 20 years ago.
There is some argument that using systems programming the way it is used today is a relatively modern convention. Here is a hacker news thread where this is discussed a bit
I guess people compare Rust and Go because they were released in similar timeframes and people like to view things in competition.
Rust is especially attractive when you can't afford a garbage collector, need deterministic destruction, and full compatibility with C. It's what C++ would be if it could start from scratch.
I think your point needs to be re-iterated more often: if garbage collection and ~2-3x the running time of C is not a problem, OCaml, Haskell, Scala, F#, etc. are the competition of Go. They integrate modern (read: mostly 70ies/80ies) language design insights, while providing approximately the same performance as Go.
I hope you understand first stable release of Rust happened less than 2 weeks ago (15 May 2015), vs. Go's Go 1 in March 2012.
3 years is pretty big difference.
Of course, but Rust has been in tech news for a while already. E.g., the Rust 0.1 post garnered 82 comments[1], over 3 years ago. Rust seems to be first mentioned in a submission title 5 years ago.
Of course, their inception was not exactly at the same time. But if we look back in 20 years, it's the same timeframe. Just like e.g. Python and Ruby, despite being 4 years apart. Or C and Pascal.
It's not fair to Rust to compare it to Go, as if they are at the same stage of their adoption and development. Several years is makes a big difference in the tech world.
It seems ridiculously reasonable to compare programming languages on the time-scale of modern computing (~70 years). Dismissing the comparison like that is pretty crazy.
However, don't get me wrong: I totally agree that the years between the stable releases of the projects makes a big difference, especially now, while it is such a large percentage of the total lifetime of them.
Instead, we get an alternative to unsafe, native and safe, scripting languages without most advantages of the best of either. I might still try it out if I do a comparative evaluation of modern work. By that time, it might have gotten better.
Whenever Go is mentioned, Rust has to be mentioned somewhere in that same thread. And vice versa. It's practically law.
Perhaps a good indication that the debates tend to be more fashion-driven then about technical points (when the discussion is about new languages itself, that is of course reasonable though).
People get bent around the wheel all the time with the tiny niches but both seem well equipped for writing user land applications and are designed to be safer than C and it's cousins. Both have some legitimate interest in them which is what really differentiates them from like D or Ada. Neither is going to be used for kernels (maybe I should say 'serious kernels') and drivers any time really soon. They have a lot of similarity in those regards.
Seems like a golden era to have 2 competing languages that are aiming at C and C++ and have legitimate community interest.