News for hackers. Stuff that matters.
Re:Rob Pike interview by jpgvm on Thursday April 30, 2020 @12:00PM (#23032312)
This isn't true at all.

Go is not the tool of choice for experienced professional programmers for exactly this reason.

The ability to quickly refactor code is very important and Go fails at it horribly for a number of reasons. 1) sheer verbosity. 2) multiple return makes altering function signatures tedious. 3) no generics mean code is written in hard to refactor styles out of the box 4) poor reflection support 5) poor tooling compared to professional grade languages (Java/C#/etc)

I could go on but long story short it's not you, it's the tool.

These issues can be overcome by remaining vigilant but for the most part they are part of the accepted "cost" of Go.

Which is to mean you pay them in return for a language that is very easy to learn (albeit hard to master because of the above problems), has a great runtime and has reasonable out of the box performance and memory footprint and stellar compile times.

These tradeoffs can actually be right for some teams, i.e larger ones with less experienced engineers that can afford to spend more cycles doing busy work refactorings.

However it's often a poor fit for small teams trying to work on software that is evolving quickly and can benefit from features of more powerful languages.

Re:Rob Pike interview by dnautics on Thursday April 30, 2020 @01:39PM (#23033604)
> Go is not the tool of choice for experienced professional programmers for exactly this reason.

that's really funny, because I always thought of Go as the language that programmers who were aging out flocked to because it has

1) google-cred

2) familiar algol syntax

3) close enough to C++ to make a run for it

4) (systems-wise) safe enough to make it worth it

5) hip enough that you don't seem like an aging out programmer anymore

(I myself am an aging out programmer, that ironically just got started, so take that as you will)

But my observation is from 5 years ago and things may have changed.

Re:Rob Pike interview by pjmlp on Friday May 01, 2020 @02:47AM (#23039640)
3) Would be true when comparing with pre-C++98, back when C++ compilers shipped pre-processor based macros for writing generic code, and used something like TObject as interface{}.
Re:Rob Pike interview by cy_hauser on Thursday April 30, 2020 @04:36PM (#23035779)
I had always thought the same thing about high use by aging out coders. Don't know how representative it is but the just released Go annual survey results seem to show that isn't the case.
Re:Rob Pike interview by pjmlp on Friday May 01, 2020 @02:48AM (#23039642)
We are busy keeping Java, .NET and C++ codebases running.
Re:Rob Pike interview by dvirsky on Thursday April 30, 2020 @01:15PM (#23033311)
> Go is not the tool of choice for experienced professional programmers

[citation needed]

Re:Rob Pike interview by Insanity on Thursday April 30, 2020 @01:47PM (#23033718)
it's turning into a bit of a theme by people not used to Go to claim this I guess..
Re:Rob Pike interview by dvirsky on Thursday April 30, 2020 @06:38PM (#23037052)
In general good "experienced professional programmers" don't have one "tool of choice" but their tool of choice varies by what they're doing. I would choose Go for a lot of things, but not for everything.
Re:Rob Pike interview by jpgvm on Thursday April 30, 2020 @06:55PM (#23037214)
Whilst I generally agree with this it's definitely the case that experience leads you to prefer certain tools over others even when they may both be usable for a specific task.

i.e Go is relatively well suited for a simplistic web service. But even if I don't expect to need to extend it I would still prefer to write it in something that is more extension friendly than Go.

Therein lies the problem. Go actually isn't better than other tools at most things so if you don't actually have a tool of choice than Go is rarely the best choice assuming you are comfortable with a large range of tools.

Building a database? C++/Rust (arguably JVM) are better choices. Building a correctness critical piece of software? Rust/Haskell are likely better choices if this is your main constraint. Building a big data pipeline? JVM language of choice is probably the clear winner because of sheer ecosystem momentum. Building a large web application? JVM/C# are miles ahead of the competition here. Building a bunch of microservices? This is probably one case where Go actually does reasonably well, if you work hard architecturally to constraint to complexity of each service it can do OK here. Unfortunately, just OK. JVM/C# probably still beat it out here because of better tooling. Building a kernel? C/C++/Rust/D/Zig. GC is a non-starter. Building a browser? See above.

Once again, I could go on. Go can be used for lots of these but all of the tools above are better for each of these domains. So if you are an experienced professional with a wide array of languages at your disposal what are you going to pick Go for?

Re:Rob Pike interview by sswezey on Thursday April 30, 2020 @08:50PM (#23038030)
I like the lack of enterprise layers that Java espouses, the simply deploys of a single binary, built in support for JSON and a perform at HTTP server. A code base that is accessible from the high level all the day to the fundamentals of the standard library. If I can’t find documentation, I can read Go code and grok it instantly. There is one style - gofmt style. Honestly, I rarely need genetics and I prefer the simplicity over over-engineered templates classes in Java and C++. If I need to do concurrency, it’s super simple and easier to get performant than Java or C++. Working with junior developers? They can learn Go in a week. Good luck with C++ and to a degree Java with the norm of relying on layers of Beans and XML frameworks.
Re:Rob Pike interview by dvirsky on Thursday April 30, 2020 @11:56PM (#23038978)
If you consider all the trade-offs (performance / simplicity / security / etc), and you need to create robust RPC services, whether microservices or outward facing API frontends - Go (to me at least) will be the best choice considering all aspects (C++ may be faster but harder to write/debug in, Java more widely adopted but a nightmare in every other aspect, Python easier but slower and less stable, etc etc).

Think about successful tools use Go - they would have been a nightmare in some aspect in most other languages. Can you imagine Kubernetes in Java? Docker in Python? It shines where it shines for a reason.

Re:Rob Pike interview by pjmlp on Friday May 01, 2020 @02:53AM (#23039664)
> Can you imagine Kubernetes in Java?

Yes, I can, that is how it was originally prototyped and due to pressure of Go advocates on the team it got rewritten in Go.

However given that Go type system isn't as advanced as Java, the result wasn't the best one.

"The clusterfuck hidden in the Kubernetes code base"

https://archive.fosdem.org/2019/schedule/event/kubernetesclu...

"Fixing the Kubernetes clusterfuck"

https://fosdem.org/2020/schedule/event/kubernetes/

Re:Rob Pike interview by saturn_vk on Thursday April 30, 2020 @04:13PM (#23035552)
> The ability to quickly refactor code is very important and Go fails at it horribly for a number of reasons. 1) sheer verbosity. 2) multiple return makes altering function signatures tedious. 3) no generics mean code is written in hard to refactor styles out of the box 4) poor reflection support 5) poor tooling compared to professional grade languages (Java/C#/etc)

1) there are worse languages in that category. some are even more widely used.

2) that doesn't make sense. return arguments are part of the argument list signature. either changing any argument makes this tedious, or none does. you indicated that only return ones do for some reason.

3) can't argue there. in the rare occasion that type asserting interfaces is required because of lack of generics, things really do suck.

4) can you elaborate on that?

5) only thing i found lacking was absence of advanced refactoring tools. for everything else, the available tooling seems to be on part with what i've used with java (anecdotal)

Re:Rob Pike interview by erik_seaberg on Thursday April 30, 2020 @04:22PM (#23035636)
On tooling, Go doesn't seem to have anything like Java's

- configurable sandboxing

- hot reloading

- AspectJ (cross-cutting code injection at link time or during classloading)

- JMX (extensible RPC API for metrics and administration)

- YourKit (interactive remote profiler wired in during classloading)

Re:Rob Pike interview by nappy-doo on Thursday April 30, 2020 @12:02PM (#23032348)
use a better editor. VSCode, vim with vimgo, emacs with whatever those apes use.
Re:Rob Pike interview by jpgvm on Thursday April 30, 2020 @12:04PM (#23032369)
This helps but doesn't solve the core issues. I generally use Goland whenever editing Go code (as I am currently doing sigh) but even with such a powerful IDE the language is the main limiting factor in carrying out refactorings (which again, I'm doing right now).
Re:Rob Pike interview by dlsniper on Friday May 01, 2020 @01:40PM (#23044553)
What kind of refactorings would you like to do but GoLand doesn't help with? I'd be interested in that kind of feedback. Thank you!
Re:Rob Pike interview by centimeter on Thursday April 30, 2020 @12:23PM (#23032638)
I shouldn't need an industrial-strength editing engine to efficiently express my ideas. (And don't, if I'm using a nice expressive language.)
Re:Rob Pike interview by throwaway894345 on Thursday April 30, 2020 @01:00PM (#23033148)
Generally speaking, Go is one of the easiest languages to write with a simple text editor. Rust is among the hardest due to its complexity and demanding static analysis. This isn't a bad thing, and tools like rust-analyzer make writing Rust a lot easier. But rust-analyzer is amazing technology from the future; hardly an ordinary text editor plugin.
Re:Rob Pike interview by eropple on Thursday April 30, 2020 @01:14PM (#23033295)
> Generally speaking, Go is one of the easiest languages to write with a simple text editor.

And one of the absolute dog's-breakfast worst to refactor regardless of editing environment. No statically typed language should be this hard to do basic changes in, and yet it exists.

Being writable in a "simple text editor" isn't a plus when the "simple text editors" in 2020 are IDEs with the name filed off.

Re:Rob Pike interview by mcqueenjordan on Thursday April 30, 2020 @04:27PM (#23035697)
OK, I'll bite...

The demanding static analysis and clear compiler errors actually make it easier and more robust to write unaided for me. Especially when it comes to refactoring -- it's essentially a process of resolving the compiler errors and you can be pretty confident you've arrived at a correct result.

Source: I write Rust everyday in a plain text editor without syntax highlighting.

Re:Rob Pike interview by centimeter on Thursday April 30, 2020 @04:19PM (#23035605)
> Go is one of the easiest languages to write with a simple text editor.

As long as you never refactor anything.

> Rust is among the hardest due to its complexity and demanding static analysis

I have never wanted or needed to offload Rust's "demanding static analysis" to my text editor. Rust's linearity/lifetime type system is really quite simple - it's not like you have to keep track of long-distance lifetime relationships in your head.

Even a reasonably powerful type system with e.g. HKTs, arithmetic, etc. like Haskell's rarely benefits from external tooling, and any interactivity can often be just as easily done via a polling build tool like ghcid rather than integrating it into a text editor.

The one place where it strikes me as sane to have a "smart" text editor is if you're using a proof assistant-style language like Coq/Idris/Isabelle/Liquid Haskell/etc. where there's actually a non-trivial amount of interactivity required while writing the code.

Re:Rob Pike interview by nappy-doo on Thursday April 30, 2020 @12:30PM (#23032756)
ever written Java?
Re:Rob Pike interview by losingthefight on Thursday April 30, 2020 @03:13PM (#23034885)
I am going to disagree pretty heavily with this. You don't give any explanations, evidence, or mention your experience, so let me lead with mine before I explain where I think you are wrong.

I cut my teeth in the 90s with C, and have professionally used PHP, Python, Java, C#, Javascript (both server and client side), and have been using Go as my main choice for the past 4 years. I've worked on teams as small as 1 up to teams in the hundreds, both as an individual contributor and tech lead. I say all that because I would consider myself an "experienced programmer". I am mostly writing APIs for web and mobile apps to communicate with, although I have written code in a wide variety of contexts. I say all of that because I can't imagine going back to Java or Python. I even migrated a bunch of my services from Typescript to Go because I found Go to be far more productive and easier to work with. Refactoring as always been easy. At my current job as a Chief Software Architect, I have over 25,000 lines of code in production running Go. I say all of that to provide background and context on my humble opinions.

1) Verbosity is among the leanest I have seen for a type-safe language. Compared to Java or C#, it is much more like Python. Perhaps the most verbose sections are a repetition of "if err != nil" blocks, but those are there for a reason and I explicitly prefer that over long "try catch" blocks.

2) Not sure what you are arguing here. If you are talking about functions returning multiple values, many languages do that. If you really don't want to, return a struct or a map. Or choose to not return multiple values. That is a choice of the programmer, if I understand you correctly. You could also use any of the major editors (I prefer VS Code) to refactor; the tooling is awesome (see #5)

3) Maybe it is due to the nature of what I do, but I have never once thought "man, I wish I had generics for this." I am sure there are some who genuinely need it, but I haven't run across that in my own experiences. I find that structs and interfaces have been everything I needed there, but again, my use case is on the server.

4) I haven't needed to use reflection either, so I have no comment here.

5) Hard disagree. GoLand (by Jetbrains) and VSCode are INCREDIBLY powerful. I will never go back to Eclipse or Visual Studio if I can avoid it. Go ships with tons of tools (formatters, linters, vetters, etc) and integrate with a ton of others (delve, etc). So your statement simply isn't true.

Your last statement is probably what drove my response. I was able to spin up a full API server incredibly quickly alone, and then with one other person, in a fresh startup with minimal issues. Rules and requirements were changing daily, so the code and business logic had to change. I can't imagine having to do that kind of work in Java (don't get me started on the deployment story here...). I would argue Go is a great fit for small teams. It is a small language with opinions, so programmers can focus on their use case.

Go isn't perfect, but it's my tool of choice. That's my two cents though.

Re:Rob Pike interview by dehora on Thursday April 30, 2020 @05:55PM (#23036633)
Great to see an answer that provides context and reason for a language preference. By way of reflection on your answers:

1) This is hit and miss for me. I have to read Go code frequently: not every day or even week, and sometimes under incident pressure. It's less verbose than Java/C#/JavaScript, more verbose than Python/Ruby/Scala. But it's sufficiently verbose to require, for me, cognitive discipline to not skim (ie, "I've been skimming, need to go back up" awareness). So when I'm reading go I put my Java/C#/JavaScript hat on not my Python/Ruby/Scala hat. Not a big problem, but it was so, so close to being in the latter camp. For me then, its regularity claims are something of a wash such that I'd like to see some supporting empirical data or summation of anecdote that it does in fact optimise well here and make good engineering tradeoffs.

2) The problem (I think) is being being to skip by the returned values. It's better than return codes in C, but you're not absolutely required to handle them. I suspect trying to patch structured returns onto an algol-like is a dead end, and if we want structured returns, we want to use a language that really induces us to 'process it forward' eg via map/flatmap/case handling, rather than adding ceremony around if. I think Go made sensible and realistic choices here.

3) Lack of generics are a pain, but a pain for writers. Go does not optimise for that concern, except afaict for its core language creators who have escape valves. The conspiracy theorist in me says Go was wait and see on generics (and exceptions, and objects) as a function of when it was incepted, and may now reasonably conclude that generics are here to stay so the language will need to solve for them, but objects and exceptions were good holds. ie, I don't completely buy it required a decade to figure it out, but could buy it took a decade to observe generics are not going away.

4) In Go, this seems to be satisfied by codegen and templated YAML. I wonder if this is generational, in that the need for reflection might be lessened because of how work on cloud/virtualised systems happens (networked services handling data in and out, with regular deployments).

5) Agree. GoLand I find a great tool for reading and delving into programs, and VSCode is a fantastic 'every day carry' for code.

Re:Rob Pike interview by runald on Thursday April 30, 2020 @10:06PM (#23038439)
Javascript is plenty concise and expressive. Can you give an example where Go is less verbose compared to javascript?

Edit: C# is actually quite expressive too, I have a hard time believing Go is less verbose than C#.

Re:Rob Pike interview by jpgvm on Thursday April 30, 2020 @10:53PM (#23038631)
Most people that think C# is verbose haven't used modern C#. It's an excellent language and if I had to go back to MS world I wouldn't bad sad at all.

That said right now I get little opportunity to use it because it doesn't fit into the current ecosystems I am working in. Shame because it really is a joy to program in, tooling is excellent async programming in C# -just works- which isn't the case in Rust, Java (or Kotlin) or anything comparable.

So while I don't get to use it often I hold C# in high regard.

Re:Rob Pike interview by hashamali on Thursday April 30, 2020 @01:42PM (#23033652)
Hm, not sure I agree with some of those criticisms:

1) I don't think Go is in the Java (pre 8) realm of verbosity, but I concede it's not as compact as say Python. 2) Technically you can write single return Go but idiomatic Go leans towards immutability so it's not recommended. 3) I've run into the lack of generics a few times, but personally haven't been too hampered by it. This is an entirely valid complaint, hopefully support will be added soon! 4) Some would argue this is a feature. ;) 5) This was more true a few years ago. Now with Go Modules for package management and VSCode + Go extension with full debugger freely available, tooling is much improved.