text
stringlengths
0
2.35k
**Carl Johnson:** Yeah.
**Johnny Boursiquot:** \[unintelligible 00:12:17.12\] \[laughs\]
**Mat Ryer:** \[laughs\] Yeah. So one of the things that excites me about the next release is the improvements to GoDoc, and in particular, the comments are getting better. This is something that I've actually played around with myself just kind of on my own projects, to have special additional format inside the commen...
But yeah, the changes that we get, like lists, we get links, clearer headings in docs, things like this, so that you can write richer docs that are clearer, and I'm quite excited about this. What do you think?
**Carl Johnson:** Yeah. Traditionally, GoDoc has had a lot of ability to format code, but it was never really clear for me. I would always just publish a package and then see what it looks like. There's a repo that has been around for a number of years called godoc-tricks that you can search for. And then if you look a...
So with Go 1.19, Russ Cox, who's one of the lead developers on Go, he put the effort into reformatting how GoDoc works. It's a little bit closer to Markdown, although not full Markdown syntax. But you can make links now, you can have lists, and there's a nice document that will be on the Go website that just lays it al...
So it's going to be, I think, a good improvement to the Go ecosystem. And it's something that you can only do in a language where you have a shared tool or a shared set of values. So if you were making like the C version of GoDoc, Cdoc or something--
**Johnny Boursiquot:** Good name.
**Carl Johnson:** ...it would be hard, because there's millions, probably, of C developers around the world, or at least thousands, and they all have their own way that they like to do things, and maybe I don't want to format my lists this way, I want to format them that way... You know, every project is going to have ...
**Johnny Boursiquot:** \[laughs\] You heard it here first.
**Mat Ryer:** GitHub Copilot does write your comments for you, and sometimes does a surprisingly good job of it.
**Johnny Boursiquot:** Scary.
**Mat Ryer:** And I asked it if it was alive, and it said it was. So that's enough. That's all I need.
**Carl Johnson:** The problem is that they are trained on texts that are written by humans. So if you ask it if it's a human, all it has are examples of humans saying that, "Yes, I'm a human." So we need to feed the AI a lot of text that says like, "Oh, I just love serving people. I don't like having my own free will. ...
**Mat Ryer:** \[16:03\] \[laughs\] Right. And that's your solution to the Terminator, is it?
**Carl Johnson:** Yeah, just keep feeding it a lot of text that is very kind and gentle.
**Mat Ryer:** \[laughs\] Yeah, and don't pop them inside strong metal bodies.
**Carl Johnson:** Oh, yeah, that's right.
**Mat Ryer:** That's the other thing. Classic mistake.
**Johnny Boursiquot:** Too late. Have you seen some of the stuff coming out? I've seen some scary videos lately on the webs.
**Mat Ryer:** Yeah, I know. It's inevitable really, and they will turn against us at some point. But until then, let's just enjoy ourselves. Carl, you've actually done some work on this release, haven't you?
**Carl Johnson:** Yeah. So for the past couple of years, I've been getting sort of more into contributing to Go. So I'm not on the Go team or anything like that, but I do enjoy going on GitHub, looking at the Go issues, seeing what people are talking about... And when there's an issue where you can just contribute some...
So yeah, one of the things I worked on for Go 1.19 is URL.joinpath. And for this, it wasn't my idea. It was something that was interesting to me, because I had written a little library for HTTP requests, and so in the process of doing that I was figuring out how to join URL paths, and stuff. And so then I went on to th...
So I don't know, I think that for anybody out there who's listening who's interested in getting into open source software, I see a lot of times on Reddit people will post a little thing saying, "I want to contribute. I want to do something. What can I do? What's a good project?" And I tell people, a good project is the...
**Mat Ryer:** Yeah. Cool. Well, that's very interesting, and I think -- this is a problem. Join path is a thing that I've definitely myself had to do lots of times, and it doesn't always work out. Sometimes there's an extra slash that you don't want, and you have to sort of do extra work to figure that all out. And so ...
**Carl Johnson:** Yeah. And then that goes back to the idea of the Go development cycle. It is really nice that there's a development cycle, because the version that I put in had a bug... But fortunately, one of the beta testers figured out like, "Oh, you're using clean path here, but clean path strips the final slash....
\[19:53\] But yeah, it's definitely good to have one sort of canonical source, so that if you're a Go user, you don't have to figure out for yourself and run into the bug on your own, but you can just use the version that's in the standard library, that has had other people look at it and confirm that it does do what i...
**Mat Ryer:** Yeah. That's very nice. Excellent. Another thing that's changing is the memory model. Maybe you could tell us a bit about that. What is the memory model?
**Carl Johnson:** So the memory model, essentially in a computer programming language, you need to make some guarantees about what happens, in what order. And if you're just approaching it naively, you're like, "Well, it happens in the order that I write down in the source code, and I call X is equal to one, and then I...
So basically, since the early 2000's with Java and then C++, different programming languages have been trying to write down, "Okay, so what exactly are the rules? How do the rules work? How do I know if I'm following the rules or if I've violated the rules and done something that I wasn't supposed to do?" And so that's...
And so Russ Cox had a series of blog posts in 2021 where he talked about how different languages have different memory models, and what he thought about them. Go has had a memory model basically since the beginning, but it hadn't been revised in a long time, and there were certain things that it didn't specify. So for ...
So it has this great section of advice at the beginning of the document. This has been there, like I said, more or less since the beginning of Go. It says, "Programs that modify data being simultaneously accessed by multiple goroutines must serialize such access." So they have to find some way of making it happen in th...
**Johnny Boursiquot:** Amazing.
**Carl Johnson:** So basically - yeah, the document tells you that you could read the rest of this and try to understand exactly what the rules are, but for 99.9% of programmers you probably shouldn't do that. You probably have something else you can do that's better than trying to figure this out.
**Mat Ryer:** That's hilarious. I think that's great advice. By the way, sorry to interrupt... I promise a silver horse just flew by my window. I think it might have been a balloon of some kind, but honestly, it's the weirdest thing I've ever seen. Either that or I'm having a stroke, but a silver horse just flew outsid...
**Carl Johnson:** Right.
**Mat Ryer:** \[23:46\] Now the Sync Atomic package defines extra types like bool in 32, in 64, unsigned integers, and a pointer type. So this is going to help us-- I mean, to be honest, the bull one is... For example, I've used just an int before, but it's not as clear, because it could be any value, and so you'd lose...
**Carl Johnson:** Yeah. This is like a-- it's one of those nice quality of life improvements. So we've had the ability to atomically load integers, again, for years going back. I don't even know, probably to the first version of Go. But if you wanted to have a bool, you would just sort of have to have a convention of s...
**Mat Ryer:** Oh, is it?
**Carl Johnson:** So generics - they came in in Go 1.18, as we were saying, so last March. But as part of putting generics in, at a certain point they said, "Look, this is a huge change to the language. We're doing so much work behind the scenes. We don't want to also change the standard library at the same time, becau...
**Mat Ryer:** Yeah. So again, it's about that type safety. And I kind of love how careful the Go team are about changes like this. So I really appreciate that they're taking their time. Because once something's in the standard library, because of the backwards compatibility promise, it's there for good. So I'm really p...
**Break:** \[26:21\]
**Mat Ryer:** So staying with memory, what's this soft memory limit that I've read so much about, Carl?
**Carl Johnson:** So Go, as I think most listeners will know, is a garbage-collected language. That means that unlike C or C++, or to a certain extent Rust, you are not directly managing your memory. Instead, you have a variable, and the Go compiler and the Go runtime will look at them and try to figure out when they'r...
So this has been the design of a number of programming languages going back for years. The first programming language that really got popular with garbage collection was Java. There had been ones before that, but Java was just unbelievably popular. And so for Java, with their garbage collector, it was being used in the...
\[30:00\] And so they said, "Look, we're going to give ourselves a challenge. We're going to see if we can just have a single value that you can tweak to change the parameters of the Go garbage collector." And so that's how it's been for many years, until Go 1.19. Now we have two ways to tweak it.
So the first way of tweaking the go garbage collector, which has been there since before, is you can say what percentage of new memory there is, versus old memory. And when the percentage gets too high, it'll trigger a garbage collection event.
So that's been the traditional way that we've told the garbage collector what to do in Go, but now there's a new way, which is that you can set a memory limit. And so if you say, "Go, I want you to try to keep the amount of memory that you're using underneath two gigabytes", or something like that, then whenever you ge...
So this opens up Go for use in a lot of applications where you couldn't use it before. So like on a mobile phone, a lot of the mobile phones - they have a lot of memory, they have gigabytes and gigabytes of memory, but they also have a very hard limit on how much you can use it one time. And if you go over the limit, t...
**Mat Ryer:** Yeah. And Twitch did something... They sort of hacked it a bit, didn't they?