text stringlengths 0 2.35k |
|---|
**Jerod Santo:** Yes, from behind the soundboard, to ask some questions today. If you listened to our Charm episode of The Changelog, which we aired in the Go Time feed because there was so much Go talk on that episode, you know that I've been Go curious as of late. But I have my apprehensions, I have my questions. I h... |
**Kris Brandow:** \[04:12\] Oh, hey! Doing pretty well. On for the second time this year. This first quarter has flown by so quickly. |
**Jerod Santo:** You're back, baby. You're back. |
**Kris Brandow:** Yeah. Can't believe it's March already. Or I guess April, by the time this episode comes out. |
**Jerod Santo:** Yeah, Q1 has come and gone, and here we are, Q2... But what else is gonna happen, right? Every day another Q goes by... |
**Kris Brandow:** Yeah. |
**Jerod Santo:** The sentence didn't even make sense. \[laughter\] Let's introduce Ian Lopshire... I'm doing my best Mat Ryer impersonation with the non-sequiturs. So every time I say something silly or dumb, just assume that it was a Mat Ryer impression. We have Ian Lopshire, a guest, but a common guest. Welcome back ... |
**Ian Lopshire:** Yeah, happy to be here. I'm kind of reeling right now, because I hadn't thought that Q2 was over yet, but... I just looked at the date, and you're right. |
**Kris Brandow:** Q2 isn't over, Q1 is almost over. |
**Ian Lopshire:** Oh, my bad. Q1, yeah. But still. The quarter is almost over. |
**Jerod Santo:** I confused him by saying "Every day a Q goes by." \[laughter\] |
**Kris Brandow:** Q85. |
**Jerod Santo:** Yeah, settle down, Ian. Settle down. You don't have to freak out that much. |
**Ian Lopshire:** But Q1 is almost over, and that's scary. But here we are. |
**Jerod Santo:** But here we are. And it's Go Time. So before we get into my questions, I've also gathered a few questions from Go Time audience and Twitter folks about what they're curious about the Go programming language. I wonder, from each of you maybe - don't go deep, don't tell us about your birth and stuff; but... |
**Ian Lopshire:** Yeah, so pre-Go I was writing mostly PHP and JavaScript, and the company I actually worked for at the time kind of decided they wanted to go with more compiled languages, so we had a choice of C\# or Go. And my team went with Go. I think the first questions and issues I had when I started was around 1... |
**Jerod Santo:** Cool. Kris, what about you? I think you hit on a couple of things actually that are in my list, so I'm right there with you. Kris, go ahead. |
**Kris Brandow:** Interestingly, when I started my career I almost started it with Go. I kind of looked at it, got really confused actually by the := syntax, and ran away... |
**Jerod Santo:** Also in my list. Okay, keep going... |
**Kris Brandow:** So I started with PHP, and then... Funny little thing about me and Sam Boyer - we both lived in the Drupal community for a while; and I went to a meetup where I met him once, and we were talking, and I was like "There's something I don't like PHP." And he was like, "Complexity. You should try Go. It's... |
**Jerod Santo:** Yeah. Very cool. So to give a little bit of my background - I've started off in Perl back in the early 2000's, went from Perl to Ruby, also learned a little bit of C, but just enough to be dangerous. I never actually worked daily in C. I did Ruby for many years, added JavaScript, of course, because I'v... |
\[08:11\] Back when I did client work, I had a client who needed one endpoint, and they needed it to be really fast... And it was just like a JSON endpoint that took a few arguments and spit out different responses. I can't remember the exact thing. And Go -- this was pre-1.0. Go was very new, and I always liked the ne... |
And then recently - you know the Go Panic game show, and the... What's the other one called? On JS Party we call it Frontend Feud... Gophers Say. That's what we call it. Gophers Say has that in-browser UI with the scores, and the faces, and all the questions, and these things... And that was static HTML for a while. We... |
So I've written probably around 200 lines with Go. So I'm not completely newb, but almost completely newb. But I'm very interested in it because I'm interested in building a Changelog command line for fun and for interest, and I think it's a great language for that reason, for distributing command line appliations. It ... |
Also, just producing Go Time for many years, I know a lot about it at a very shallow level, which makes it less intimidating than other languages, like Rust, for example, which I know there's a lot of interest in that, and a lot of comparisons, and a lot of verticals that both languages play in. So it would be another ... |
That being said, there's stuff in Go where as a person who hasn't really written much of it, I'm just like "I don't get it", or why... A lot of the questions are "Why? Why does it work this way?" And the first one is slices and arrays. |
In most other languages there's an array, or a list, or something... But Go has these two, and one is like a substitute -- I don't really understand it that much. It seems like everybody uses slices all the time. Can you guys explain to me what's a slice, what's an array, why are they different, and when should I use e... |
**Kris Brandow:** Sure. For the first question there, "What's a slice and what's an array?" - an array is a fixed-size group of data, I guess you could say. I'm trying to say it without saying the word "array" or "slice" here. And iterable is also a bad word, but... It's just like a slab of memory that you can have, th... |
Whereas slices are much like arrays, in that you can have these kind of enumerations of things in them, but they are resizable. So you can go from a slice that is size 10 to a slice of size 11 by adding something to it. So it's kind of like the base level of the difference between a slice and an array. |
\[11:53\] You can also think of it as like a slice is a pointer to an array, and the programming language just does all of the magic for you when you need to get a larger array kind of just giving it to you and handling all of the copying of what was in the old array into the new array, and all of that. |
**Jerod Santo:** Okay. So arrays sound more like what we used to do in C, where you pre-allocate slots, or memory for a fixed length. And if you wanna go beyond that, obviously, you walk off the side of an array, now you're in overflow land, and security problems. But you could then have a pointer to that... There's th... |
**Ian Lopshire:** I mean, Kris pretty much covered it. The way I think about it - a slice is what an array should be. |
**Jerod Santo:** That's why -- it goes to my next question, why are there two separate data structures, or I guess concepts? Are they just concepts, or are they data structures? I don't know. |
**Ian Lopshire:** They're different data structures. |
**Jerod Santo:** Okay. |
**Ian Lopshire:** You never really see the underlying data structures of a slice. It's kind of opaque. |
**Jerod Santo:** Okay, fair enough. They're different data structures. Why are there two? Go is about simplicity. So like in JavaScript there's an array; that's what you've got. But in Go there's two... Sorta. |
**Kris Brandow:** I would take a guess... This is probably language lore, which someone can probably answer from the community out there, but I would say that they probably started with just arrays, and then realized these aren't very friendly to use... But in the way that Go is simple, it has tools that are purpose-bu... |
I also assume it has something to do with typing in the language... Because when you have a slice, and the way that you add things to a slice, if you use this function called append, and you kind of put a slice in, and you get a slice back out, but the types of those slices need to match each other for that function to... |
I imagine it would have been more complicated to do that with arrays, because in Go, in addition to -- you can't kind of resize an array. Arrays of different sizes are different types; so an array of five strings is a different type from an array of six strings. It's a different type of an array if you have seven strin... |
**Jerod Santo:** Gotcha. So just use slices, pretty much, unless you know better. |
**Kris Brandow:** Yeah. For beginners there's very few reasons why you would want to use an array. Array is definitely one of those advanced user tools. |
**Jerod Santo:** Okay. I think as a beginner you come to it from a different language and you're like "What I need here is an array", because that's what it's called elsewhere. So then you go searching for arrays, and then you find something that seems more complex. Not complex, but lower-level, perhaps, than what you'... |
**Kris Brandow:** They probably should have named it array and static array. An array would be equivalent to what a slice is now, and a static array would be what we have in an array now. |
**Jerod Santo:** I think slice in general is just not in other languages as a data structure, and so it's somewhat unique to Go, at least in my experience, where I'm coming from. |
**Kris Brandow:** Yeah. |
**Jerod Santo:** See how I hedged that quite a bit at the end...? \[laughs\] I was thinking, "There's lots of languages out there, Jerod. Maybe it's common elsewhere." Okay. Let's stick with some syntax thing... So the equal sign and the colon equals thing... WTF? I don't know. Ian, let's let you go first on this one. |
**Ian Lopshire:** The quick assignment - I think it exists so that you don't have to define the type of a variable. Quick assignment I can just say "Whatever this type I'm assigning to this is the type of this variable. Otherwise you have to define a type. So I think it just adds some expression. It really is. |
**Jerod Santo:** Is it syntax sugar then? So that's the colon equals, it's the quick assignment. |
**Ian Lopshire:** Do you wanna add something to that, Kris? I really just think it's for ease of writing. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.