text stringlengths 0 2.35k |
|---|
**Angelica Hill:** Jonas. Unpopular opinion. |
**Jonas:** Yeah... So think I want to do a bit of a tech one, because this came up recently as I was redoing my setup... But I think you don't really need dual monitors. I think one good monitor is all you need. And I don't know, I feel like people get really into dual monitors, but I just think ultimately, it creates ... |
**Emma Draper:** I think that might be popular. |
**Jonas:** I don't know, I feel like people get so into -- like, you see people's work-from-home displays, and they've got this... Well, super-widescreen I guess it's technically one, but I might count that as two. But like everyone's got dual, or like the vertical and the horizontal, and... I just think you don't need... |
**Emma Draper:** I feel like the hacker movies have done us a disservice, where everybody is like this... It's not how it works. \[laughter\] You just need one screen. |
**Angelica Hill:** Well, we'll see if everyone agrees with you. And on that unpopular/possibly popular opinion note, it's been a pleasure talking to you all today... We'll have to get you back on very, very soon, side note being I'm loving looking at these lovely four ladies faces on Go Time... Side note... Couldn't st... |
• Introduction to functional programming in Go |
• History of functional programming in Go and impact of generics |
• Recap of functional programming basics (functions as mappings, composition, currying) |
• Map function for applying functions to each element in a slice |
• Flat map function for combining multiple lists |
• Filtering and zipping operations using functions |
• Pure functions and their application in programming |
• Type parameterization and its implications on function implementation |
• Generics in Go and how they enable type-safe functions with compile-time guarantees |
• Elimination of boilerplate code and reflection in functional programming libraries |
• Benefits of generics for library authors and users, including simpler interfaces and compile-time type checking |
• How generics work behind the scenes in Go, generating instances of generic functions for each supported type |
• Efficiency gains from using generics in writing functional programming libraries |
• Cautionary approach to using generics in Go, emphasizing need for experimentation and best practices |
• Discussion on whether functional programming (FP) should be used in production code, given its capabilities in Go |
• FP already present in Go through features like context and functions as first-class citizens |
• Imperative vs declarative differences in programming styles, with FP representing a more declarative approach |
• Benefits and challenges of applying functional programming (FP) concepts to Go codebases |
• Importance of declarativity in reducing lines of code, adding structure and readability, and fixing bugs |
• Education and awareness as key factors in adopting FP concepts in existing codebases |
• Potential features in Go that could enable more widespread use of FP concepts, such as type parameters on methods |
• Higher-kinded types as a complex feature that could offer advanced type constructions but add complexity to the compiler |
• Definition of lens: a tuple of two functions (getter and setter) for accessing and modifying data |
• Lenses can be used to simplify code by reducing the need for getters and setters |
• They are typically closures that take parameters and return values or errors |
• Type systems, specifically in Rust and Go, were discussed as being important for concise and readable programs |
• Aaron Schlesinger's education background: he has a Computer Science degree from 2008 and is currently pursuing a master's degree with a focus on formal methods |
• Rust has more features than Go, but also allows for longer compilation times |
• Aaron Schlesinger compares and contrasts Rust with Go from his experience |
• He finds Rust allows for more expressive code with fewer lines than Go |
• Aaron still loves Go, finding it ideal for quickly building things |
• Discussion touches on functional programming and generics in Rust |
**Johnny Boursiquot:** Welcome, welcome, friends... And those who want to be friends. You want to be friends with me, right Aaron? |
**Aaron Schlesinger:** Of course. Why do you think I'm here? |
**Johnny Boursiquot:** Awesome. Awesome. So today we're gonna talk about functional programming with generics. I'm your host, Johnny Boursiquot. If you haven't heard from me for a while, that's because I've been heads down, trying to ship some stuff that's coming out later this year, and I'm pretty excited about it, bu... |
**Aaron Schlesinger:** Nice... |
**Johnny Boursiquot:** Since I own that, I made sure to snap that up. Last time, Jon Calhoun mentioned it on a show... So joining me today is - you know him, he's been on the show before, and you see his name everywhere, especially as it relates to things like GopherCon, and getting us ready for the big show coming up ... |
**Aaron Schlesinger:** Coming up! |
**Johnny Boursiquot:** Yeah, yeah. Please join me in welcoming Aaron Schlesinger. |
**Aaron Schlesinger:** Hi, everybody. Thanks for having me, Johnny. It's wonderful to be here again. |
**Johnny Boursiquot:** Yes, yes. And it's great to have you. So we did a show on functional programming a little while back... This was episode 87, right? This was a while; this was like May something of -- let me see, let me double-check... 2019. Back in 2019. |
**Aaron Schlesinger:** Before days... |
**Johnny Boursiquot:** So a lot has happened in the GO world since then, right? Most notably, the introduction of generics in 1.18. So it was suggested, actually... There was a listener who went back and listened to the old show, and basically said, "Hey, I've found an episode on functional programming from back in 201... |
So the others - you can follow in Steve's footsteps if you want to ask for certain shows, and you can basically suggest them. We often look through the list and see what's interesting. You tell us what you want to hear, and we put on shows like this as a result of that. |
So you and I, along with Mat - we did that episode, and we learned a lot during that time; we learned how to use what we had back then, mainly things like the empty interface, and things like even generators, and things like that... And even using reflection, right? Because those were some of the things that really ena... |
\[06:15\] And even thinking that "Well, Go is really for imperative programming", right? The verbose style - not really suitable for functional programming. But I think we made a pretty good case for it, listening back to the show... But now that we have generics, I wanted to bring you back so we can talk about what's ... |
**Aaron Schlesinger:** Yeah. I think maybe we can do like a little bit of a recap of what FP is... That's actually a really good introduction into -- or I should maybe say segue into why generics can help, and kind of answer your question to "Where did generics unlock new areas of functional programming awesomeness in ... |
**Johnny Boursiquot:** \[laughs\] |
**Aaron Schlesinger:** So I'll give it a crack to start off the recap of functional programming... Really, you can go from a math perspective and say everything in FP is based on the function, and from a theoretical perspective, a function takes inputs and returns outputs. From a math perspective, you can chart a graph... |
In real life, of course, our functions don't just spit something back out. They also do some IO, or maybe talk to a file, or use a timer, or send down a channel, or whatever else. And so that's really important, actually, to remember that all of this stuff that we're going to talk about in functional programming comes ... |
So FP, the theory is things are based on the function. We can transform functions by putting two together. So if the output of one gets passed into the input of the second one, now you essentially have a transitive property where you can input to the first one and get an output from the second one, and it all looks lik... |
Then you can take those tools in Go to what I kind of think of as the next higher level. So moving into the programming world, not just the math world - because all of that stuff that I just mentioned is basically just the math world... In the programming world you can have sequences of things, like a list, or an array... |
\[10:26\] So now starting to bend the mind a little bit, what if you had a function that took in an element of a list, but then output a list itself? Now you can do something called a flat map, where you take in an element, so you apply the function on each element - the output is a list, right? So now you're taking a ... |
Now, you can go even further here, and you can start doing things like filtering... So if you have a function that takes in an element in a list and returns a boolean, you can use that to decide, "Can I make a new list, and can I decide which elements from the original list are gonna end up in the new list?" |
You can also do things like zipping, which is using a function to determine the ordering of a final list given two, or three, or four, or five, or six, or ten initial lists. So you can determine how they're interspersed together. And I'm gonna stop there, but there are a lot of other ways that we can apply this very ba... |
Forgive the overloading of the term list, but this list of things we could do - you know, it goes on... And I could spend another hour and a half talking about it. Of course, I'm not going to do that. But the reason that I went into all that is to kind of start to talk about what could we do before, and what can we do ... |
And really, thinking about generics - this is another branch of math, right? We're talking about types here, statically defined types. And not only that, but now we're able to vary the type of the input of a function, or the output of a function - we're able to vary that type based on a parameter. It's called type para... |
So if you've got a function that takes in a type parameter, or a parameter of type t, where t is a type parameter - well, I can invent infinity types, right? So if I can invent infinity types, and that function can take an infinity different types of parameters, which means there are infinitely different implementation... |
\[14:11\] So that's kind of where we're at now. The implications of this go beyond map, but fundamentally, now we're at a point where instead of using raw interfaces, or you know, the any type now, instead of doing reflection, now we can add compile-time proof that certain functions will work for some definition of wor... |
**Johnny Boursiquot:** So if I'm hearing you correctly, it seems like now -- so we're no longer arguing about some of the benefits of FP, right? So you've done a pretty good recap of why you'd want to introduce FP, or at least know of its usefulness in certain contexts. It's about now how easy is it to actually impleme... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.