News for hackers. Stuff that matters.
Re:Tor in a safer language: Network team update from Amsterdam by chrismealy on Saturday April 01, 2017 @03:43PM (#14013773)
Go is designed for average programmers working in a huge organization. That's why its dullness is a virtue.
Re:Tor in a safer language: Network team update from Amsterdam by bwanab on Saturday April 01, 2017 @05:31PM (#14014288)
Seems weird that from what I hear about the intense interview process that Google programmers go through that they'd feel a need to dumb down the language of choice.
Re:Tor in a safer language: Network team update from Amsterdam by SamWhited on Saturday April 01, 2017 @10:37PM (#14015447)
No matter how smart you are (or think you are), or how much state you can store in your head at once, if you remove some of the mental overhead of a language, then you have more time to think about other things. It's not about people needing to "dumb down" anything, it's about having a bit less mental overhead, meaning you can get a bit more done a bit easier.
Re:Tor in a safer language: Network team update from Amsterdam by danieldk on Sunday April 02, 2017 @02:16AM (#14016083)
No matter how smart you are (or think you are), or how much state you can store in your head at once, if you remove some of the mental overhead of a language, then you have more time to think about other things.

So you use a language that makes specifying ownership (and immutability hard)? I always feel Go adds a lot of mental overhead.

E.g., if you have a method that returns, say, a float32 slice. 1. If I return a slice of an array/slice that is a struct member, the caller could modify elements in the slice, breaking struct invariants. 2. Returning a copy of the slice is safe, but adds a lot of overhead. What you'd actually want is to return an immutable slice, but Go does not provide any facilities to do so (apart from wrapping a slice, but the lack of generics and operator overloading makes this tedious).

I guess a lot of Go code will just assume that returned pointers/slices/maps will not be used in a way that breaks invariants. But you usually end up reading the source code of 3rd party packages to see what is safe, whereas in other languages you could just read the method signature.

tl;dr: I think ownership and preserving invariants usually give the most mental overhead and Go does zero in that department.

Re:Tor in a safer language: Network team update from Amsterdam by fauigerzigerk on Sunday April 02, 2017 @05:04AM (#14016495)
I agree that mutability constraints are a major weakness of Go. Interestingly, they did make string immutable and added []byte as a mutable alternative. It's unfortunate that string and []byte are so similar and yet it's impossible to treat a []byte as a string without copying (with the exception of looping over runes). This leads to massive code duplication and/or lack of functionality (byteconv where are you??). Just look at the strings, strconv and bytes packages. This whole area of the language is messy.

The funny thing about Go is that it makes up for its long list of weaknesses with essentially one single strength. You can actually read other people's code without much introduction to the concepts used in that codebase, because the number of possible meanings of any particular expression is much smaller than in other languages.

There is so much talk about Go being for dumb, second rate, corporate developers, because that's what Pike essentially said at one point (perhaps without thinking first).

But in fact, it's not the developers who are dumb. It's the process by which large corporations employ and dispose of developers. They are thrown into some project and expected to "hit the ground running". There's no time for explanation. So what they do is read code to acquaint themselves with the codebase and hopefully become productive before they move on to the next job. And that is the one task where Go really shines. Reading arbitrary pieces of code.

Of course powerful abstraction features eventually make reading code easier as well, but only after having learned the abstractions created for that particular problem and codebase and only if those abstractions are very carefully crafted.

Powerful language features help writers of code long before they help readers. And that, I believe, is essentially the dirty secret that Go exploits.

We all want to be brilliant writers of code when in fact we are often readers poking helplessly at half understood code to make something happen. We even forget our own abstractions once we haven't looked at them for a couple of months or even weeks.

The problem with Go is that it not only acknowledges this state of affairs, it also enshrines it.

Re:Tor in a safer language: Network team update from Amsterdam by danieldk on Sunday April 02, 2017 @09:02AM (#14016994)
There's no time for explanation. So what they do is read code to acquaint themselves with the codebase and hopefully become productive before they move on to the next job. And that is the one task where Go really shines. Reading arbitrary pieces of code.

Definitely. This really shines in the standard library, it consists of extremely readable code and is a good way to get up to speed on canonical Go.

We all want to be brilliant writers of code when in fact we are often readers poking helplessly at half understood code to make something happen. We even forget our own abstractions once we haven't looked at them for a couple of months or even weeks.

Definitely, but what are we comparing to? I would agree that e.g. C++ and Haskell have this property. Unless you understand the language and commonly-used abstractions, template-heavy C++ code is difficult to read. However, there are many languages that have more powerful type systems than Go, but where code is still easy to read (ML, Object Pascal, Oberon, Ada, etc.).

Re:Tor in a safer language: Network team update from Amsterdam by fauigerzigerk on Sunday April 02, 2017 @10:08AM (#14017211)
I'm comparing to other widely used languges like C++, C#, Swift, Scala, Java or Python. I don't think any of them allow as few possible meanings of any given language expression as Go does. And I don't think any of them requires as little non-local information to find all code that gets called by any particular expression (perhaps with the important exception of Go's structural interfaces).

I wonder whether it is simply a theoretical tautology that the more abstraction features you have in a language, the more different possible meanings any particular syntactical expression can have, and the more effort it requires to figure out its true meaning, assuming you're not familiar with the codebase.

Or is that a false dichotomy? I am unfortunately not familiar with Ada or Oberon and Pascal is but a faint memory.

Re:Tor in a safer language: Network team update from Amsterdam by Filligree on Saturday April 01, 2017 @08:41PM (#14015034)
I have yet to meet anyone inside Google who actually likes the language. At best they call it a decent replacement for C or C++, which is damning with faint praise. Lots of people are neutral, of course.
Re:Tor in a safer language: Network team update from Amsterdam by oddthink on Saturday April 01, 2017 @11:10PM (#14015547)
I like it. My brain's already pretty full with trying to get a ML pipeline optimized and launchable, and if I need to write something to read a CSV file, make some RPC calls to a service for each row, and dump the results to a file, go just works.

Sure, I could use something like Haskell, but then I'd have to worry about whether I'm accumulating a giant stack of thunks that'll blow up. go just works, and less of it will bit-rot than the comparable python script, thanks to at least some types.

This is why the SREs seem to be fans, e.g. https://talks.golang.org/2013/go-sreops.slide#1

Re:Tor in a safer language: Network team update from Amsterdam by danieldk on Sunday April 02, 2017 @02:24AM (#14016103)
trying to get a ML pipeline optimized

I wrote some machine learning tools in Go and the experience is quite bad. The lack of operator overloading and parametric polymorphism make most ML code ugly. It also does not help that Go's compiler backend does not optimize very strongly and calling out to C comes with a relatively large overhead.

Sure, I could use something like Haskell, but then I'd have to worry about whether I'm accumulating a giant stack of thunks that'll blow up.

There are many languages between Go and Haskell that are productive and provide a sufficiently strong type system.

Re:Tor in a safer language: Network team update from Amsterdam by oddthink on Sunday April 02, 2017 @10:58AM (#14017376)
Yeah, the ML parts aren't in Go. I'm working in TensorFlow, so it's C++ scripted by Python. But there's a lot of incidental stuff that needs to be done, most of which I don't want to spend cycles on thinking hard about, and Go does a good job there, in that narrow niche where I want something that runs on one machine but find python too slow.

At a previous gig, I had done a lot of F#, and I think that's close to my personal sweet spot, but I'd have to use it frequently to keep it in my head. Go is small enough that I can load it into cache when I need it.

Re:Tor in a safer language: Network team update from Amsterdam by danieldk on Sunday April 02, 2017 @01:49PM (#14018142)
But there's a lot of incidental stuff that needs to be done, most of which I don't want to spend cycles on thinking hard about, and Go does a good job there, in that narrow niche where I want something that runs on one machine but find python too slow.

Definitely! I have continued to use Go for small utility every now and then as well. The standard library is extremely well-suited for that kind of work.

(Now using Rust more in that role as well, but mostly to get continued practice ;).)

Re:Tor in a safer language: Network team update from Amsterdam by solidsnack9000 on Sunday April 02, 2017 @03:08AM (#14016258)
I think in areas where there's a lot of math, the absence of generic collections might prove to be a frustration relative to C++ or Java (both allowed languages at Google).
Re:Tor in a safer language: Network team update from Amsterdam by psiclops on Saturday April 01, 2017 @08:41PM (#14015035)
The idea is that it makes software engineering across an organization much simpler if your language is minimal and eschews magic or complex constructs
Re:Tor in a safer language: Network team update from Amsterdam by TazeTSchnitzel on Saturday April 01, 2017 @04:38PM (#14014047)
So, Java?
Re:Tor in a safer language: Network team update from Amsterdam by IshKebab on Saturday April 01, 2017 @06:03PM (#14014423)
Kind of, but with more `strings.hasSuffix(...)` and less `new StringComparatorFactory(new StringSubsetComparison(), StringComparisonPositions.END_POSITION, ...`
Re:Tor in a safer language: Network team update from Amsterdam by Groxx on Saturday April 01, 2017 @06:51PM (#14014607)
Give it time, Go is still pretty new and requires reinventing all those wheels and flexibility-allowances. It's already visible in some areas though - e.g. look at the hoops you have to code through to allow decent unit testing of controller-style code. Anything of interest has to be exported and injected, or you simply can't do it. Even Java's significantly better here with its runtime manipulation.
Re:Tor in a safer language: Network team update from Amsterdam by pjmlp on Sunday April 02, 2017 @02:37AM (#14016156)
In Java it is string.endsWith(...), not much different.
Re:Tor in a safer language: Network team update from Amsterdam by IshKebab on Sunday April 02, 2017 @03:41PM (#14018643)
Ok bad example but you get the idea.
Re:Tor in a safer language: Network team update from Amsterdam by pjmlp on Saturday April 01, 2017 @04:55PM (#14014123)
No, Java has become too advanced for the typical Go developer.

Too many features.

Re:Tor in a safer language: Network team update from Amsterdam by geodel on Saturday April 01, 2017 @08:09PM (#14014914)
It is for me. Could not figure out advanced tools like Maven or gradle. Maybe it was beneath Java experts at Sun/Oracle develop simple cli tool that could compile a java project with one command.
Re:Tor in a safer language: Network team update from Amsterdam by pjmlp on Sunday April 02, 2017 @01:55AM (#14016012)
You mean just using javac -sourcepath is too hard?
Re:Tor in a safer language: Network team update from Amsterdam by Filligree on Saturday April 01, 2017 @08:42PM (#14015038)
'gradle build'

Unless the project is very badly configured, that should be all you need to compile it. Now, writing those .gradle files...

Re:Tor in a safer language: Network team update from Amsterdam by geodel on Saturday April 01, 2017 @09:01PM (#14015099)
Yea, advanced language like Java should have advanced build tools and build files. Go is simplistic so `go build|install|run` just works without IDEs, build files, and external build tools.
Re:Tor in a safer language: Network team update from Amsterdam by danieldk on Sunday April 02, 2017 @02:32AM (#14016135)
Well, yes, if you include the build tool in with your language implementation you do not need external build tools.

Compiling most Java projects is usually as simple as 'brew install maven; mvn package'. Maven does require a build file, but it can also do more than the go utility, such as deploying artifacts in a repository, build distributable tarballs, RPMs, debs, etc.

Maven, like go, largely relies on convention over configuration as well. If you generate a POM file from the standard archetype, you basically drop your files in the right source directory and it will build.

(I am not a fan of Java, but I think a lot of the criticism here is lazy. The first time you use the 'go' tool you have to learn its usage as well: how to separate library code from programs, what are the conventions for package structure, how to avoid API breakage for downstream users, etc.)

Re:Tor in a safer language: Network team update from Amsterdam by vorg on Monday April 03, 2017 @03:34PM (#14026300)
> Now, writing those .gradle files...

Gradle build files have confusing syntax. Just knowing which lines have an equals sign and which don't is a bit of work.