News for hackers. Stuff that matters.
Re:Go: What We Got Right, What We Got Wrong by dekhn on Thursday January 04, 2024 @04:46PM (#38872709)
This is a retrospective written by Rob Pike, one of the creators of the Go language.

I worked at Google at the time go was created and had coffee with Rob from time to time and got to understand the reasons Go was created. Rob hates Bjarne Stroustrup and everything C++ (this goes back decades). C++-as-used at Google (which used far more threads that he says) had definitely reached a point where it was extremely cumbersome to work with.

I can think of some other things that they got wrong.

For example, when I first started talking to Rob and his team about go, I pointed out that scientific computing in FORTRAN and C++ was a somewhat painful process and they had an opportunity to make a language that was great for high performance computing. Not concurrent/parallel servers, but the sorts of codes that HPC people run: heavily multi-threaded, heavily multi-machine, sophsticated algorithms, hairy numerical routines, and typically some sort of interface to a scripting language with a REPL.

The answers I got were: Go is a systems programming language, not for scientific computing (I believe they have now relaxed this opinion but the damage was already done).

And a REPL wasn't necessary because Go compiled so quickly you could just write a program and run it (no, that misses the point of a repl, which is that it builds up state and lets you call new functions with that built-up state).

And scripting language integration was also not a desirable goal, because Go was intended for you to write all your code in Go, rather than invoking FFIs.

A number of other folks who used Go in the early days inside Google complained: it was hard to call ioctl, which is often necessary for configuring system resources. They got a big "FU" from the go team for quite some time. IIUC ioctls are still fairly messy in Go (but I'm not an expert).

I think Go spent a lot of time implying that goroutines were some sort of special language magic, but I think everybody knows now that they are basically a really good implementation of green threads that can take advantage of some internal knowledge to do optimal scheduling to avoid context switches. It took me a while to work this out, and I got a lot of pushback from the go team when I pointed this out internally.

IN short, I think go could have become a first-class HPC language but the go team alienated that community early on and lost the opportunity to take a large market share at a time when Python was exploding in ML.

Re:Go: What We Got Right, What We Got Wrong by rdtsc on Thursday January 04, 2024 @05:34PM (#38873230)
> Go is a systems programming language,

I remember that being a meme of sorts. Most people understood that as a C/C++ replacement with operating systems and drivers being written in Go. System programmers laughed, of course. Eventually when it didn't look like it wasn't going happen, the token reply from Go devs became "Well not those kind of systems, we always meant a different kind of systems programming language, not what you all thought".

Re:Go: What We Got Right, What We Got Wrong by sevagh on Thursday January 04, 2024 @10:14PM (#38875285)
From the same team that came up with the unique, searchable, and identifiable word "Go" for a programming language.
Re:Go: What We Got Right, What We Got Wrong by kragen on Friday January 05, 2024 @03:50AM (#38877065)
rob pike's definition of 'systems software' from 02000 is in http://doc.cat-v.org/bell_labs/utah2000/utah2000.html

> Systems: Operating systems, networking, languages; the things that connect programs together. Software: As you expect. (...) What is Systems Research these days? Web caches, Web servers, file systems, network packet delays, all that stuff. Performance, peripherals, and applications, but not kernels or even user-level applications.

he goes into a lot more detail there on the things he sees in 'systems software research', and it goes pretty far beyond kernels and drivers. this is not a definition he retconned onto golang in 02014 or, i would claim, a definition unique to him

Re:Go: What We Got Right, What We Got Wrong by rdtsc on Friday January 05, 2024 @08:39AM (#38878900)
Then which languages aren’t systems languages? Python can connect things together, BASIC, Java, Javascript. I guess only some GUI DSL languages might not be.
Re:Go: What We Got Right, What We Got Wrong by kragen on Friday January 05, 2024 @01:43PM (#38882858)
some are worse at it
Re:Go: What We Got Right, What We Got Wrong by mattbee on Thursday January 04, 2024 @04:55PM (#38872825)
I think Java's "green" threads only ran on a single core, a stop-gap for 90s machines that only had one.

Goroutines use OS threads, but only create one OS thread per core. Go does the scheduling internally on top of those few "real" threads.

Java itself now provides a goroutine-type model with Virtual Threads, but as the programmer you've got to ask for it.

Well, I just felt like "green" is a confusing moniker in that context.

Re:Go: What We Got Right, What We Got Wrong by zozbot234 on Thursday January 04, 2024 @05:20PM (#38873101)
Goroutines use thread-per-core but run stackful fibers on top of that. (A similar model is sometimes known as "Virtual Processors" or "Light-weight processes".) This is unlike the use of stackless async-await in other languages. This peculiar use of fibers in Go is also what gets in the way of conventional C FFI and leads to quirks like cgo.
Re:Go: What We Got Right, What We Got Wrong by jtasdlfj234 on Thursday January 04, 2024 @05:40PM (#38873293)
Excellently described.

I'd love to see a resource that highlights these all on a table across programming languages as well as the associated strengths and weaknesses of such threading & concurrency models.

Perhaps a ByteByteGo graphic, if you will.

Re:Go: What We Got Right, What We Got Wrong by dekhn on Thursday January 04, 2024 @05:59PM (#38873497)
In the future, I think thats what I'll say. Thanks.
Re:Go: What We Got Right, What We Got Wrong by pcwalton on Thursday January 04, 2024 @06:02PM (#38873526)
I usually just say that Go implements "userspace threading", since that's really what it is. Some early, pre-pthreads, implementations of Linux threads worked the same way as Go does and they usually called such implementations "M:N", to indicate M userspace threads mapped onto N kernel threads, so "M:N" is a good descriptor too.
Re:Go: What We Got Right, What We Got Wrong by dekhn on Thursday January 04, 2024 @06:30PM (#38873719)
but that's not really accurate. It uses system threads. Userspace threading doesn't make a transition to kernel (IIUC).
Re:Go: What We Got Right, What We Got Wrong by pcwalton on Thursday January 04, 2024 @06:41PM (#38873784)
Go doesn't need to transition to the kernel to switch threads, does it? It just saves and loads the register state in userland.
Re:Go: What We Got Right, What We Got Wrong by dekhn on Thursday January 04, 2024 @06:51PM (#38873871)
IIUC it can, sometimes, avoid a kernel transition when it knows it can schedule the recipient of a message, but I believe that golang creates a threadpool for running goroutines on platforms that use thread primitives.

From https://github.com/golang/go/blob/c7d6c6000a84b61ac8bb2e38e8... I believe "worker threads" are OS threads.

Re:Go: What We Got Right, What We Got Wrong by Thaxll on Thursday January 04, 2024 @06:52PM (#38873884)
The Go runtime can create more that one thread per core, especially when there is some blocking syscall.
Re:Go: What We Got Right, What We Got Wrong by unscaled on Friday January 05, 2024 @02:34AM (#38876671)
Back when Java had green threads (the late 1990s), there was no such thing as "multi-core machines". Some top-of-the-line servers had SMP (i.e. two or more physical processors running together on the same bus and sharing the same memory), but very few programs were built to take advantage that option yet.

So Java's green threads was not a stop-gap for the 90s machine which only had one core. That's preposterous. Does Go need to disable its goroutines to support the Raspberry Pi Zero that has only one core? Obviously not! The reason Java didn't support multi-core scheduling is that multi-core processors still weren't a thing, and SMP was too high-end for them to bother (and by the time they did start caring about high-end systems, they've already moved to kernel threads).

Nothing prevents green threads from supporting multi-core (Java 21's Virtual Threads obviously do that, but Erlang's processes also had SMP support well before Go).

I think the terms "green threads" or "user-space threads" are really not that confusing. Definitely not confusing enough to warrant inventing a new term like "goroutines". THAT is confusing. I'm happy the Project Loom team resisted the urge to give the Virtual Threads a fun name like "Jorutines".

Re:Go: What We Got Right, What We Got Wrong by kragen on Friday January 05, 2024 @04:05AM (#38877127)
sun, where java was written, was shipping smp computers with 64 processors in 01997, two years after they first released java https://en.wikipedia.org/wiki/Sun_Enterprise

they bought that off cray, but in 01995 a few months after they released java, they (a different division) released the dual-processor ultra 2 https://en.wikipedia.org/wiki/Sun_Ultra_series

but that wasn't sun's first smp machine; the sparcserver 630mp, among others, supported four cpus in 01991 https://en.wikipedia.org/wiki/SPARCstation#Server_systems

i had a dual-processor smp pentium pro under my desk by 01998, running windows nt 4.0 and occasionally java

really tho the bigger issue with java performance was that there was no supported native-code compiler until hotspot; though gcj was available, sun didn't support it, and i don't recall its performance as being that great. so by writing your code in java you were usually wasting 95% of your cpu on the bytecode interpreter, like python today. it wasn't something you'd do for things that required a lot of cpu

Re:Go: What We Got Right, What We Got Wrong by npalli on Thursday January 04, 2024 @05:01PM (#38872892)
Good historical perspective thanks for it. Your comments on scientific computing/HPC are interesting. Golang could indeed have solved the two-language problem and taken off like a rocket in comparison to where it is (hovering in the top 15). However, I think it would have to tackle some very orthogonal concepts - to the systems language creators like Rob and others on the go team - like vectorization as first class concept, parallelism (not green threads) etc. which might have limited some of the initial implementation efficiencies, not sure. There is still room for such a language (Julia is getting there...) perhaps some disgruntled FORTRAN elder who is sick of C++ will create such a new language :-)
Re:Go: What We Got Right, What We Got Wrong by leeoniya on Thursday January 04, 2024 @04:51PM (#38872772)
> And scripting language integration was also not a desirable goal, because Go was intended for you to write all your code in Go, rather than invoking FFIs.

"just avoid cgo" is a something i've heard many times from all Go devs

Re:Go: What We Got Right, What We Got Wrong by norir on Thursday January 04, 2024 @08:21PM (#38874551)
> And a REPL wasn't necessary because Go compiled so quickly you could just write a program and run it (no, that misses the point of a repl, which is that it builds up state and lets you call new functions with that built-up state).

He'd have had a point if the go compiler could reliably compile programs in faster than 50-100ms. The claims that go is a fast compiler always seem to be relative to c++ or something. Last time I checked just compiling hello world took over 200ms which was shocking to me given how I'd heard that one of the language's claims to fame was a fast compiler.

Re:Go: What We Got Right, What We Got Wrong by randomdata on Friday January 05, 2024 @11:44PM (#38888503)
Thing is, there are several REPLs for Go. That we have quite a few comments pretending that Go doesn't have a REPL comes as a direct result of nobody – that is, beyond the REPL authors wanting to scratch an itch – ever needing one. After all, if a REPL was necessary, the people commenting that Go doesn't have a REPL would know that Go has a REPL as they would be users.

Pike's point has proven itself here.

Re:Go: What We Got Right, What We Got Wrong by tejohnso on Thursday January 04, 2024 @05:17PM (#38873066)
> Rob hates Bjarne Stroustrup

That sounds extreme. What did Bjarne do to him?

Re:Go: What We Got Right, What We Got Wrong by dekhn on Thursday January 04, 2024 @06:04PM (#38873548)
Bjarne took the wonderful thing that was C and made C++. Rob is not a fan of C++: he thinks the language evolved badly and added poor concepts from the beginning (IIRC iostreams and templates were two of the concepts), and it embedded a number of design decisions that led to extremely slow compiles and links (like, 45 minutes to link a Google binary). Ian Taylor even wrote a better linker (gold) for Google to deal with that.
Re:Go: What We Got Right, What We Got Wrong by formerly_proven on Thursday January 04, 2024 @06:35PM (#38873751)
Compare the designs of iostreams (Stroustrup) and the STL (Stepanov), conclusions left as an exercise for the reader.
Re:Go: What We Got Right, What We Got Wrong by dekhn on Thursday January 04, 2024 @07:30PM (#38874163)
when I discovered STLport around 2001, it was a real revelation and very convenient because I was finally able to compile the code my coworkers wrote on "real UNIX" with "real C++ compilers" (lol cfront) In researching my answer I came across http://www.stlport.org/resources/StepanovUSA.html# "putting it simply, STL is the result of a bacterial infection."
Re:Go: What We Got Right, What We Got Wrong by verinus on Monday January 08, 2024 @07:29AM (#38911018)
thank you for that link. what a diamond of interesting stuff!
Re:Go: What We Got Right, What We Got Wrong by aragonite on Thursday January 04, 2024 @05:22PM (#38873123)
Don't know about Rob Pike in particular but Ken Thompson, who probably had the same reasons for "hating" Stroustrup, had this to say about him (from Coders at Work):

Seibel: You were at AT&T with Bjarne Stroustrup. Were you involved at all in the development of C++?

Thompson: I'm gonna get in trouble.

Seibel: That's fine.

Thompson: I would try out the language as it was being developed and make comments on it. It was part of the work atmosphere there. And you'd write something and then the next day it wouldn't work because the language changed. It was very unstable for a very long period of time. At some point I said, no, no more.

In an interview I said exactly that, that I didn't use it just because it wouldn't stay still for two days in a row. When Stroustrup read the interview he came screaming into my room about how I was undermining him and what I said mattered and I said it was a bad language. I never said it was a bad language. On and on and on. Since then I kind of avoid that kind of stuff.

Seibel: Can you say now whether you think it's a good or bad language?

Thompson: It certainly has its good points. But by and large I think it's a bad language. It does a lot of things half well and it's just a garbage heap of ideas that are mutually exclusive. Everybody I know, whether it's personal or corporate, selects a subset and these subsets are different. So it's not a good language to transport an algorithm—to say, “I wrote it; here, take it.” It's way too big, way too complex. And it's obviously built by a committee.

Stroustrup campaigned for years and years and years, way beyond any sort of technical contributions he made to the language, to get it adopted and used. And he sort of ran all the standards committees with a whip and a chair. And he said “no” to no one. He put every feature in that language that ever existed. It wasn't cleanly designed—it was just the union of everything that came along. And I think it suffered drastically from that.

Seibel: Do you think that was just because he likes all ideas or was it a way to get the language adopted, by giving everyone what they wanted?

Thompson: I think it's more the latter than the former.

Re:Go: What We Got Right, What We Got Wrong by aragonite on Thursday January 04, 2024 @08:22PM (#38874558)
But also see previous discussion of these remarks on HN:

https://news.ycombinator.com/item?id=27938122

Re:Go: What We Got Right, What We Got Wrong by zozbot234 on Thursday January 04, 2024 @08:55PM (#38874790)
Interesting opinion, it certainly shows the broad mindset behind Golang (and its predecessors Alef and Limbo). Also let's face it, it really took Cyclone and Rust to prove that a broadly C++ish language could be made both safe for large-scale systems and developer-friendly. If your only point of reference is C++ itself, these remarks are not wrong per se.
Re:Go: What We Got Right, What We Got Wrong by el-dude-arino on Thursday January 04, 2024 @05:26PM (#38873160)
99% of programmers, but especially the brilliant/well known ones, are insufferable egotists. Many cannot have a technical disagreement without despising the person they disagree with.

Professionalism and the tech industry are just starting to get acquainted.

Re:Go: What We Got Right, What We Got Wrong by anotherevan on Thursday January 04, 2024 @06:32PM (#38873732)
> 99% of programmers, […] are insufferable egotists.

As I read this while sipping my turmeric latte my monocle popped right out!

Re:Go: What We Got Right, What We Got Wrong by 1attice on Thursday January 04, 2024 @05:46PM (#38873351)
Most professions, quietly, are currently like this. Architects and scientists and doctors and surgeons and lawyers all develop strong opinions about each other based on their positions.

For instance: ask a lawyer what they think about the overturning of Roe v Wade. Now ask them what they think about their colleagues who disagree. Don't forget to duck.

Which isn't to say that we wouldn't all be much better off with more distance between our opinions and our identities. But the thing you're looking for is a cultivated practice that is often not at odds with 'egotism' (what is that, precisely, anyway?) but _entailed by_ it: the not-wanting-to-be-the-kind-of-person-who-does-XYZ.

Not all vanities are risible.

What you're looking for is a long-cultivated, inward practice that can be supported or hindered by all the usual forces, local context (culture, practice, etc) chief among them.

Put another way: your claim isn't that most programmers are unprofessional. It's that they're _uncollegial_. And you're right. So are a lot of other contemporary professionals. It's a shouty era.

Re:Go: What We Got Right, What We Got Wrong by zik on Thursday January 04, 2024 @07:35PM (#38874191)
That kind of behaviour leads to a lot of valuable people abandoning workplaces because they can't stand the abusive atmosphere. In the end all that's left are the shouty arseholes and that doesn't do anyone any favors.
Re:Go: What We Got Right, What We Got Wrong by 1attice on Thursday January 04, 2024 @09:23PM (#38874960)
Correct. But my original post is not normative, but rather descriptive. Despite how things should be, this is how they are.

I've found that it's extraordinarily valuable to separate these two cognitive modes wherever possible.

Re:Go: What We Got Right, What We Got Wrong by geodel on Friday January 05, 2024 @12:23AM (#38875998)
So where do those valuable people end up then?
Re:Go: What We Got Right, What We Got Wrong by 1attice on Friday January 05, 2024 @12:47AM (#38876122)
Well, a shockingly high percentage drop out of their profession, and get stuck somewhere doing something like CSR.
Re:Go: What We Got Right, What We Got Wrong by rramadass on Friday January 05, 2024 @01:13AM (#38876265)
Re:Go: What We Got Right, What We Got Wrong by rramadass on Friday January 05, 2024 @01:11AM (#38876253)
To paraphrase more generally;

99% of [people], but especially the brilliant/well known ones [in any domain], are insufferable egotists.

IMHO this is normal. When somebody puts in a lot of effort in mastering something they intrinsically know that they are better than most people in that something. As social animals, getting "noticed" is a form of being conferred "status" in the group. Thus you tend to "act out" to acknowledge/confirm that recognition. It is fine as long as it is within acceptable social bounds and not out of touch with reality.

Re:Go: What We Got Right, What We Got Wrong by liampulles on Thursday January 04, 2024 @04:52PM (#38872779)
Interesting context. I use Go a lot for enterprise backend type work and I have to say I'm glad its not geared towards being an HPC language, but to each their own.
Re:Go: What We Got Right, What We Got Wrong by randomdata on Thursday January 04, 2024 @04:52PM (#38872784)
> I believe they have now relaxed this opinion

Or is it that scientific computing is starting to realize that it can benefit from a systems programming language?

Scripting langages are great for exploratory work, but if you want to put to work into production, scripting starts to really show its limitations. There is a reason systems languages exist. There is good reason why they both exist. They are different tools for different jobs.

Re:Go: What We Got Right, What We Got Wrong by coldtea on Thursday January 04, 2024 @05:06PM (#38872945)
>Or is it that scientific computing is starting to realize that it can benefit from a systems programming language?

Can't be it, since a huge percentage of scientific computing is done with a scripting language.

A systems programming language is still good for the backend libraries of scientific computing - but Go has zero share of that.

Re:Go: What We Got Right, What We Got Wrong by randomdata on Thursday January 04, 2024 @05:08PM (#38872967)
A huge percentage of scientific computing is scripting in nature. It would be silly to use anything other than a scripting language.

But not all. Whether or not it is Go that gets the job, a systems language of some kind would be beneficial in those circumstances.

Re:Go: What We Got Right, What We Got Wrong by galaxyLogic on Thursday January 04, 2024 @05:45PM (#38873337)
There are 2 conflicting goals: 1) Having a language in which it is easy to express and try out ideas and 2) Producing fast and safe programs.

A scripting language would seem to be good for the exploratory scientific research, because of that. Whereas when you need to create a performant library that can do heavy crunching with reproducible results on any platform you need the other. The questions is: Do you know what you want to implement, or is that still an open question?

Re:Go: What We Got Right, What We Got Wrong by randomdata on Thursday January 04, 2024 @06:48PM (#38873853)
No doubt it starts as an open question and slowly moves towards knowing.

Which isn't really much of a conflict. You can prove out your thoughts in a scripting language, and after the dust has settled you can move the workload to a systems language. Different jobs, different tools.

I guess if you're one of those weird religious types that insist there is only one true God (read: programming language) you might feel conflict, but nobody else cares.

Re:Go: What We Got Right, What We Got Wrong by galaxyLogic on Friday January 05, 2024 @05:55PM (#38886186)
> Different jobs, different tools

And possibly different programmers.

Say your a (non-computer-) scientist. It is not (typically) part of your job to learn Rust or Haskell.

You might want to learn Rust if you are so inclined but many scientists are not.

Re:Go: What We Got Right, What We Got Wrong by randomdata on Friday January 05, 2024 @11:22PM (#38888392)
I'm sure there are exceptions, but generally speaking, do scientists ever really end up working on systems?

Anecdotally, I work with a lot of scientists and they only write scripts. When systems are needed, they hand it off to the development team. Anyone can fumble through scripting, but there is a lot more to think about when building systems, and that's probably not something most scientists want to put effort into – for the same reasons they probably don't want to learn Rust.

Realistically, learning Rust is the easiest part of becoming a systems programmer. But there is little incentive to learn any system language if your workload is always scripting in nature. You are going to, rightfully, reach for a scripting language.

Re:Go: What We Got Right, What We Got Wrong by coldtea on Friday January 05, 2024 @04:11AM (#38877168)
>There are 2 conflicting goals: 1) Having a language in which it is easy to express and try out ideas and 2) Producing fast and safe programs.

Why are they "conflicting"?

Common Lisp could do both quite well.

Re:Go: What We Got Right, What We Got Wrong by galaxyLogic on Friday January 05, 2024 @05:52PM (#38886158)
Because different languages give different focus to different features. I'm not saying there can't be a language that supports multiple goals well, but it's a bit like" Jack of All Trades".
Re:Go: What We Got Right, What We Got Wrong by aragilar on Friday January 05, 2024 @01:18AM (#38876298)
But Go lacks a good FFI story (see CGo discussions), so Go has no hope here.
Re:Go: What We Got Right, What We Got Wrong by randomdata on Friday January 05, 2024 @01:26AM (#38876356)
What are you referring to?

The only active, related discussion I am aware of is about the high call overhead imposed by the gc compiler. Of course, other Go compilers have different calling conventions. tinygo, for example, can call C functions from Go about as fast as C can call C functions. So that isn't really a Go issue, just a specific compiler implementation issue. And as you know (it's in the link!), the Go team themselves maintain two different compilers and pride themselves on Go not being defined by one compiler. To equate gc and Go as being one and the same would be quite faulty.

So obviously you are not talking about that one. What else are people discussing?

Re:Go: What We Got Right, What We Got Wrong by coldtea on Friday January 05, 2024 @04:09AM (#38877152)
>So obviously you are not talking about that one.

Obviously? Not of the above rings obvious to me.

A "specific compiler implementation issue" when said compiler is the compiler that 99% of Go users use, can just as well be called a Go issue.

Whether "the Go team themselves maintain two different compilers and pride themselves on Go not being defined by one compiler" is basically irrelevant in praxtice, since people using/interested in Go predominantly mean and use a specific compiler (unlike with C++ where they might use one of several available compilers equally likely).

>To equate gc and Go as being one and the same would be quite faulty.

No, it would be the most pragmatic thing to do. De jure and de facto and all that.

Re:Go: What We Got Right, What We Got Wrong by randomdata on Friday January 05, 2024 @08:39AM (#38878903)
I appreciate your dedication to reminding us that your original comment was posted without any research or thought, but it remains that the Go project itself, along with other third-parties, provide different FFI solutions so that you can pick the one that best suits your circumstances. There is no one-size-fits-all solution.

99% of Go users don't need an FFI story at all. They can choose a compiler on different merits. If you have an FFI story to consider, then it is logical that you will need to evaluate your choices on different attributes and very well might find that the compiler 99% of users with different problems won't match your own. gc is not ideally suited to FFI. But Go offers compilers that are. This is not a Go problem. Go provides solutions. What you speak of is only a gc thing.

What story do you have for us next? That your neighbourhood restaurant, with a full menu, has no hope because the one dish you tried wasn't to your existing taste – not having it occur to you that other items on the menu might be exactly what you are looking for?

Re:Go: What We Got Right, What We Got Wrong by aragilar on Friday January 05, 2024 @11:32PM (#38888444)
But 99% (probably 100%) of scientific computing users do need FFI, hence why there's no overlap. While there may be other compilers, my impression is most Go devs, and hence most Go libraries, assume you're using the standard golang compiler, and so FFI remains a problem for expanding the Go ecosystem to specific use-cases. I'm not suggesting Go has support scientific computing (in fact, it's likely better for everyone if it doesn't), but it's likely Go will continue to be a non-entity in scientific computing landscape, absent someone throwing loads of money at a specific use-case and effectively locking people in.

It's worth noting that other new languages (e.g. Rust) are being adopted, because they have an reasonable FFI story.

Re:Go: What We Got Right, What We Got Wrong by randomdata on Friday January 05, 2024 @11:59PM (#38888569)
99% of scientific computing tasks are script in nature, so Go is not a good fit anyway. It is decidedly a systems langue, not a scripting language. Different tools for different jobs.

Yes, obviously you can write scripts in a systems language, and systems in a scripting language, but you will have a better time if you write systems in systems languages, and scripts in scripting languages. There is good reason why we make a distinction between the two.

The scientists are almost certainly using Python. If not Python, R or Julia. And that is in large part because these are scripting languages. It is true that amongst the 1% that are systems, Rust has found a place, but it too will never make any serious headway into the scripting realm. It is also a systems language. Different tools for different jobs.

Re:Go: What We Got Right, What We Got Wrong by coldtea on Saturday January 06, 2024 @05:50AM (#38890326)
>I appreciate your dedication to reminding us that your original comment was posted without any research or thought

I, on the other hand, don't appreciate the ad hominem. What happened, have manners gone out of style?

Also, what exactly fault do you find with my original comment: that Go isn't really a player in scientific computing. Does your "research or though" suggest otherwise?

>99% of Go users don't need an FFI story at all. They can choose a compiler on different merits.

Users of X don't need Y is a self-fullfilling prophecy when X doesn't offer Y. Languages without Y don't tend to attract users who need Y.

We're also talking about users doing scientific computing here, where the vast majority does need an FFI story.

>gc is not ideally suited to FFI. But Go offers compilers that are. This is not a Go problem. Go provides solutions. What you speak of is only a gc thing.

And gc is 99% of what people understand and use as Go - not gccgo. Unless gc has a good support for certain features, scientific computing ain't gonna happen.

People aren't going to heavily invest in building scientific programming libs interop with Go, when those would just work fast enough in a different less used go compiler as opposed to the mainstream one.

>What story do you have for us next? That your neighbourhood restaurant, with a full menu, has no hope because the one dish you tried wasn't to your existing taste – not having it occur to you that other items on the menu might be exactly what you are looking for?

Yeah, because a different version of a compiler doesn't come with different maturity, different technical tradeoffs, different community using it, different support story, and so on, it's just like "picking another item from a menu".

If that's your understanding of the situation, I can see how your argument would make sense in your mind ("just change the compiler, it's easy").

Using another language as an example: If CPython didn't have a good interop story with scientific libraries, even if PyPy did, "Python" would have gone nowhere in that domain.

And people who can't understand this, would talk all day getting blue in the face about how "it's not a Python problem, it's a CPython problem", as if that would change anything.

Re:Go: What We Got Right, What We Got Wrong by randomdata on Saturday January 06, 2024 @10:06AM (#38891989)
> What happened, have manners gone out of style?

Manners are for engagement between people. Forum-going is a solitary activity. Maybe there is a human out there twisting nobs and pulling levers to make the software work, but if so, that's just an implementation detail hidden from the user. If that were replaced with software, I wouldn't notice, or care.

> what exactly fault do you find with my original comment: that Go isn't really a player in scientific computing.

The original contextual comment, not first comment ever written...

> People aren't going to heavily invest in building scientific programming libs interop with Go

They aren't going to invest anyway, as the vast majority of scientific computing tasks are script in nature. Go is decidedly not a scripting language. It isn't trying to be, and doesn't want to be. There were already a number of good languages in the scripting space before Go came along.

This is like lamenting that wrenches aren't winning the race in nail driving dominance. Who cares?

Re:Go: What We Got Right, What We Got Wrong by Guvante on Thursday January 04, 2024 @05:32PM (#38873209)
Except what does Go get for ditching the REPL?

It already has a substantial runtime (the usual pain of an REPL)

Re:Go: What We Got Right, What We Got Wrong by ncruces on Thursday January 04, 2024 @08:38PM (#38874668)
Not being able to create new code at runtime is a pretty huge freepass for the compiler to implement stuff a certain way.

You can bet the Go compiler and runtime leverage that assumption.

Re:Go: What We Got Right, What We Got Wrong by Guvante on Friday January 05, 2024 @02:10AM (#38876566)
Even without optimizations?
Re:Go: What We Got Right, What We Got Wrong by ncruces on Friday January 05, 2024 @08:33AM (#38878852)
Yes. There are long standing feature requests for (e.g.) the reflect package that simply don't get done because they'd break this assumption and/or force further indirection in hot paths to support "no code generation at runtime, ever".

Packages like Yaegi (that offers an interpreted Go REPL) have "know limitations, won't be addressed" also because of these assumptions.

https://github.com/golang/go/issues/4146

https://github.com/golang/go/issues/16522

https://github.com/traefik/yaegi?tab=readme-ov-file#limitati...

Re:Go: What We Got Right, What We Got Wrong by Guvante on Friday January 05, 2024 @03:09PM (#38884161)
If they wanted an REPL having an interpreted Go compiler isn't unheard of in the space.

It isn't like a hypothetical C++ REPL would use unmodified LLM under the hood after all.

Re:Go: What We Got Right, What We Got Wrong by ncruces on Saturday January 06, 2024 @07:45AM (#38890984)
Then just use Yaegi, which I linked to above.

It has the limitations mentioned, which are necessary to make duck-typed interface calls reasonably efficient, if you assume no code generation at runtime, ever.

There's really no other way. If you don't know before hand all the interfaces that might exist, and/or all the types that might implement them, interface method calls would necessarily either need to be JIT generated, or a string based hash map lookup (runtime reflection, which exists, but is slow).

Go avoids both by knowing statically at compile time the list of all interface and the list of all types that can ever possibly implement them and building vtables for those.

Re:Go: What We Got Right, What We Got Wrong by randomdata on Thursday January 04, 2024 @05:35PM (#38873235)
What would it gain? REPLs make perfect sense for scripting problems, but when you would you ever use it for systems problems?
Re:Go: What We Got Right, What We Got Wrong by dekhn on Thursday January 04, 2024 @06:54PM (#38873891)
often when I am developing systems code or RPC client code, I sit in a REPL and make repeated ad-hoc calls to various functions, building up various bits of state (I started using python long before Jupyter). I find this much more intuitive than writing code, compiling it, executing it, going back to the editor, changing the code, re-running it with something that loads a bunch of data, just so I can answer a question about the runtime behavior of the system I'm working with.
Re:Go: What We Got Right, What We Got Wrong by randomdata on Thursday January 04, 2024 @07:00PM (#38873947)
There is certainly something to be said about being able to answer questions about another system by poking at it, but that is a scripting task. You would be better served by a scripting language. And, as it happens, most scripting languages come with REPLs. That is a solved problem that was solved long before Go was ever imagined.

Just because you are building a particular systems program does not mean everything you do has to be a systems problem. And, really, if you don't exactly know what you're building, it is probably too soon to consider any of it a systems problem.

Re:Go: What We Got Right, What We Got Wrong by Guvante on Friday January 05, 2024 @02:12AM (#38876572)
You say systems problems like Go is for embedded work.

Half the things I have seen replaced Python scripts. Seeing what your internal state is after taking X action is exactly what REPLs are good at...

Re:Go: What We Got Right, What We Got Wrong by randomdata on Friday January 05, 2024 @05:10PM (#38885678)
> You say systems problems like Go is for embedded work.

I'm not sure who is talking about embedded work. That didn't come from me. There is nothing in this thread about embedded. Did you accidentally press the wrong reply button?

I say that Go is for systems. Do you think Go is actually designed for scripting? If so, why?

> Half the things I have seen replaced Python scripts

Python is often used to build systems.

Python is a scripting language, yes, but that doesn't mean you can't build systems in it – just as you can build scripts in a systems language. But there are tradeoffs in crossing paths like that. Systems languages will be better for building systems, and scripting languages will be better for building scripts.

Perhaps the applications you speak of are actually systems and that is why developers saw reason to convert them into using a systems language?

> Seeing what your internal state is after taking X action is exactly what REPLs are good at...

Quite good. But that workload is not systems in nature, so why would you ever do that in a systems language? That is a scripting workload. Naturally you would use a scripting language. And, lucky for you, most scripting languages include REPLs out of the box!

Re:Go: What We Got Right, What We Got Wrong by chaxor on Thursday January 04, 2024 @05:26PM (#38873154)
It's ok that Go didn't work out for scientific crowds, since Julia works better for the scientific community as a replacement for hacky Matlab/c++/Fortran conbled-together scripts.
Re:Go: What We Got Right, What We Got Wrong by leetrout on Thursday January 04, 2024 @04:53PM (#38872794)
I dream of a world where we have Go or something similar with the same / similar UX of Jupyter Notebooks. I keep an eye on Julia but I never make the leap to use it and still pickup Python (or Go).
Re:Go: What We Got Right, What We Got Wrong by Art9681 on Thursday January 04, 2024 @06:40PM (#38873782)
https://github.com/gopherdata/gophernotes

I've had this bookmarked for some time and just havent gotten around to it.

Re:Go: What We Got Right, What We Got Wrong by zozbot234 on Thursday January 04, 2024 @05:14PM (#38873037)
https://github.com/evcxr/evcxr can run Rust in a Jupyter notebook. It's not Golang but close enough.
Re:Go: What We Got Right, What We Got Wrong by pphysch on Thursday January 04, 2024 @05:00PM (#38872881)
This seems misdirected. Go clearly wasn't designed for scientific computing, and that's okay. I've successfully written some multi-node MPI codes in Go, but there's not much advantage over C, and likely some disadvantages relating to the Go runtime and linking behavior.

Python (largely) is the present and future of scientific computing because people realized you can write the mathy kernels in something low-level and just orchestrate it with ergonomic Python and its bountiful ecosystem/mindshare. Python adequately checks all the boxes and I don't see how a newcomer like "Scientific Go" or R or Julia will ever unseat it. Not to mention curmudgeonly researchers have little desire to learn new tricks.

But I do use Go when needed as a systems language, and it is fantastic for whipping out the occasional necessary microservice (due to network boundaries, etc).

Re:Go: What We Got Right, What We Got Wrong by theLiminator on Thursday January 04, 2024 @05:20PM (#38873096)
I think the main issue with Python tends to not be performance (though it can be hard to speed up certain bottlenecks), but rather there's a point where maintaining it goes from very easy to very difficult due to lack of static typing. Where this occurs can be pushed further back with very careful programming discipline (or by adopting mypy et. al from the start). But I could see a world where something go-like with a little more expressivity could've become that glue language instead of python.
Re:Go: What We Got Right, What We Got Wrong by pphysch on Thursday January 04, 2024 @05:27PM (#38873166)
This is a software engineering practices problem rather than a Python problem. Python has great tooling and language support for type annotations. I work on large Python codebases with ease because I leverage these things. My IDE is able to do static analysis and catch potential typing errors before runtime.

The problem is we have researchers with no SWE expertise writing huge codebases in Jupyter notebooks inside a bespoke, possibly unreproducible Anaconda environment. That is going to be a maintenance disaster no matter which language is being used.

And if you force your researchers, who are using to being productive prototyping in Python, R, etc. to use a statically-typed language, they are going to complain and be a lot less productive at their job.

Re:Go: What We Got Right, What We Got Wrong by theLiminator on Thursday January 04, 2024 @05:30PM (#38873199)
I find mypy and the other type checkers I've used kinda painful due to false positives.

I think with proper type inference, there would be a lot less pain around static typing.

Ideally users should be forced to type their function signatures and everything else can be inferred.

Definitely I do agree with you that the situation today is much superior to even just 4-5 years ago.

Re:Go: What We Got Right, What We Got Wrong by truculent on Thursday January 04, 2024 @07:48PM (#38874296)
> newcomer like ... R

R is only 2 years younger than Python (32 years old)

Re:Go: What We Got Right, What We Got Wrong by lamontcg on Thursday January 04, 2024 @05:28PM (#38873181)
> I don't see how a newcomer like "Scientific Go" or R or Julia will ever unseat it.

Julia's support for Autodiff

Re:Go: What We Got Right, What We Got Wrong by google234123 on Thursday January 04, 2024 @04:55PM (#38872823)
There’s engineers at Google trying to get things done, and ones trying to create new languages… they don’t talk to each other too much
Re:Go: What We Got Right, What We Got Wrong by qaq on Friday January 05, 2024 @03:43AM (#38877034)
Are there a lot of HPC workloads at Google compared to concurrent/parallel servers?
Re:Go: What We Got Right, What We Got Wrong by kragen on Friday January 05, 2024 @03:51AM (#38877067)
well, now there are. but pagerank was one from the beginning
Re:Go: What We Got Right, What We Got Wrong by dekhn on Friday January 05, 2024 @11:13AM (#38880661)
pagerank was implemented as an iterative mapreduce on classic hardware (and sibyl later adopted this model, using MR as an engine to do what is really an HPC job). Not sure I really consider it HPC, more like high throughput. HOwever, the MR approach worked really well when google was scaling super-fast in the early days; if they'd chosen to solve the problem using MPI and infiniband on expensive SGIs, they probably wouldn't have become the company they are today.
Re:Go: What We Got Right, What We Got Wrong by kragen on Friday January 05, 2024 @01:43PM (#38882844)
agreed about infiniband and sgis, but numerically approximating the principal eigenvalue of a large sparse matrix seems solidly in the core of traditional hpc. btw pagerank predates mr by several years
Re:Go: What We Got Right, What We Got Wrong by tgv on Friday January 05, 2024 @04:02AM (#38877116)
I can totally agree on excluding scientific computing. A lot of that simply is more cobbling something together than software engineering. And HPC wouldn't be happy with Go anyway.

> Python was exploding in ML

It's very easy to start in Python. So it's taught everywhere, and everyone knows it. Until 10 years after the majority of colleges have replaced Python with another language, Python will stay dominant. From that point of view, Mojo is quite clever.

Re:Go: What We Got Right, What We Got Wrong by sapiogram on Friday January 05, 2024 @09:29AM (#38879391)
> I think Go spent a lot of time implying that goroutines were some sort of special language magic, but I think everybody knows now that they are basically a really good implementation of green threads that can take advantage of some internal knowledge to do optimal scheduling to avoid context switches. It took me a while to work this out, and I got a lot of pushback from the go team when I pointed this out internally.

This comment deeply fascinates me, because I get the same feeling every time I go back and read/watch early Go resources from Rob Pike and others, but I've never actually heard it articulated before. I've always thought that surely they weren't that ignorant about PL theory and history? Or maybe Rob Pike himself was, but surely his team knew better?

It really feels like they thought they were making some special hybrid between threads and coroutines, combining the advantages of both. Like this 2011 talk[1] which demonstrated a classic coroutine code pattern implemented with goroutines and channels. But as time went on, goroutines became fully pre-emptive, and their programming model is now identical to threads. Using them as coroutines only leads to misery (read: data races) in my experience. They're faster than OS threads, sure, but that's an implementation detail at this point.

When do you think they eventually realized they were re-inventing the same green threads Java had created and scrapped 10 years earlier?

[1] https://www.youtube.com/watch?v=HxaD_trXwRE