text
stringlengths
0
2.35k
[1384.14 --> 1390.34] Do you think that applies even more so for those who want to practice functional programming in Go?
[1390.46 --> 1394.80] Or do you think, actually, it makes our lives a lot easier.
[1394.92 --> 1395.78] Let's just go full level.
[1396.54 --> 1399.34] Well, that is good advice for all software.
[1399.84 --> 1402.24] So yes, the answer to your question is yes.
[1402.72 --> 1402.84] Right.
[1402.84 --> 1411.54] There is no telling right now whether map is enough, right?
[1411.72 --> 1413.20] Or no one wants to use it.
[1413.56 --> 1423.02] And if people do want to use map, there's no telling whether the parallel version of that is better or complementary to the regular serial version of map, for example.
[1423.02 --> 1423.52] Right.
[1423.52 --> 1438.68] So the parallel version for listeners would be instead of applying the function on every element of the list one after the other, it's applying them in parallel with X number of Go routines or at least concurrently with X number of Go routines and then returning the result.
[1439.18 --> 1439.32] Right.
[1439.32 --> 1442.86] There's no telling right now.
[1443.06 --> 1445.14] You can say this is correct.
[1445.14 --> 1446.74] You can say this is possible.
[1447.10 --> 1454.00] You can guess this might be useful for this case or this case or this type of software or that type of software.
[1454.00 --> 1459.30] But there's no substitute for usage in the wild in the community, if you will.
[1459.72 --> 1461.60] There's just no substitute.
[1461.60 --> 1463.74] So these things should be tried.
[1464.32 --> 1473.14] Maybe, you know, we should go a little crazy, as they say, as the Go team has said, a little overboard to see what is possible.
[1473.14 --> 1478.08] But we should not say that this is the result.
[1478.32 --> 1481.00] This is the solution to all problems in FP.
[1481.48 --> 1492.64] We should get these things out there, play around with them, experiment with them, see what works at a larger scale, and then say that is the solution to problems X, Y, and Z.
[1493.12 --> 1496.02] You know, this is why we all say we test in production, right?
[1496.24 --> 1501.04] Because there's no substitute for real world use cases.
[1501.04 --> 1501.40] Yeah.
[1501.40 --> 1503.46] In that case, it's data.
[1503.72 --> 1510.52] And in our case, it's programmers experimenting with things and seeing what actually works in real world code bases.
[1510.72 --> 1511.68] But it's the same effect.
[1512.62 --> 1517.38] So picking back off of that, the thread that we paused and now I want us to resume.
[1517.92 --> 1518.68] You see what I did there?
[1519.36 --> 1519.96] I do.
[1520.20 --> 1520.70] I do.
[1520.88 --> 1521.44] I love it.
[1522.66 --> 1528.32] The idea of basically the when to use generics, right?
[1528.32 --> 1531.24] And in our case here, when to use functional programming.
[1531.24 --> 1534.96] I think that's a fair question to ask whether or not, you know, regardless of generics, right?
[1535.02 --> 1545.62] So one of the sort of the strong gripes that I found out there, right, that I've heard even in talking to some folks is that, look, Go is imperative, right?
[1545.62 --> 1546.58] Through and through, right?
[1546.70 --> 1553.68] We're kind of side bending and kind of pushing it in a direction it wasn't meant to, right?
[1553.68 --> 1558.62] Even though some of its features and its capabilities are well suited, right, for functional programming.
[1558.80 --> 1562.52] You know, functions being first class citizens and et cetera, et cetera.
[1562.68 --> 1566.46] A lot of the sort of the things you look for in functional programming, you can do and go.
[1566.46 --> 1569.04] But just because you can doesn't mean you should, right?
[1569.08 --> 1570.00] That whole adage, right?
[1570.24 --> 1583.20] So is functional programming still in the realm of sort of experimentation and just people who are curious and they can play around with it, but really like at work or whatever, right?
[1583.26 --> 1585.52] You know, you don't they don't really use it, right?
[1585.52 --> 1589.40] Like, where are we in terms of really, I guess it's an adoption question, right?
[1589.48 --> 1597.46] Like, are people interested or increasingly more so interested in using FP now, even with the bells and whistles that are enabled right through generics?
[1598.04 --> 1605.04] Is FP attractive enough for people who are traditionally doing this imperative style, especially in the world of Go?
[1605.68 --> 1610.54] Should they be looking or really should we try to bring FP into our production code?
[1611.00 --> 1611.86] Well, it's already here.
[1611.86 --> 1618.40] Anyone who uses context is using a part of FP, right?
[1618.48 --> 1622.64] Because context has a with cancel and with timeout.
[1622.76 --> 1625.34] Those return a function, right?
[1625.50 --> 1627.80] This is how pervasive FP is.
[1627.92 --> 1632.96] That is technically a higher order function because it's a function returning.
[1633.16 --> 1639.32] With cancel is a function and that's returning a function that you call to close to free the resources.
[1639.32 --> 1644.82] There's an internal Go routine running, right, with a timer and, you know, and freeze that resource, right?
[1645.26 --> 1645.94] That is FP.
[1646.08 --> 1659.52] And I think like all technologies that are used by more than a trivial number of people in the world, a corner of this technology is used a lot, right?
[1660.10 --> 1662.08] SQL is another good example here.
[1662.36 --> 1664.20] You can do many, many things with SQL.
[1664.20 --> 1669.64] You can turn Postgres SQL or PostgresQL, is that how you say it, right?
[1670.04 --> 1670.56] Yeah, yeah.
[1670.60 --> 1671.12] I'll allow it.
[1671.74 --> 1672.14] Okay.
[1672.48 --> 1672.76] Yeah.
[1672.84 --> 1673.10] Okay.
[1673.14 --> 1674.72] It's got the Johnny stamp of approval.
[1675.38 --> 1680.46] You can turn PostgresQL into a time series database if you want to, for example, right?
[1680.46 --> 1683.48] By using very advanced features of SQL.
[1683.76 --> 1689.50] But not many people do that because obviously it's not the, a lot of times it's not the best tool for the job.
[1689.62 --> 1700.04] But also most people prefer, including myself, to stick with a smaller set of foundational features of the technology.
[1700.64 --> 1703.16] And same thing with FP, right?
[1703.16 --> 1706.86] There is a smaller set than even all the stuff that I said today.
[1707.40 --> 1712.54] There's a smaller set of functionality that most people prefer to use.
[1712.64 --> 1721.42] And my hypothesis for why that is, is because it makes more sense and it fits into more workloads, right?
[1721.42 --> 1734.60] And so if you need to capture some state of a function and expose one operation on that state to the caller, using a higher order function makes a lot of sense.
[1734.94 --> 1741.88] It's a lot easier than doing a bunch of boilerplate and building a whole struct and storing the state in the struct and having a bunch of methods on it.
[1741.88 --> 1750.92] And that, it just fits right into that use case and it applies, that use case is applicable and exists on a ton of workloads.
[1751.08 --> 1752.90] And so we use it, right?
[1752.98 --> 1756.28] So FP, strictly speaking, is, is everywhere.
[1756.76 --> 1760.46] Now I'm going to modify your second question a little bit accordingly.
[1760.90 --> 1764.44] You said, should we be trying to get FP into more workloads?
[1764.44 --> 1773.68] Well, given that it's already a lot of places, I'm going to modify it and say, should we get more features of FP into more workloads?
[1774.30 --> 1775.42] Will you allow that?
[1776.86 --> 1777.98] Yeah, yeah, let's do it.
[1778.50 --> 1779.58] Yeah, tell me more.
[1779.92 --> 1781.70] All right, so now we've got the seal on that.
[1781.94 --> 1782.18] All right.
[1782.92 --> 1789.16] And so the way that I think about it is try to model it as the imperative declarative difference, I guess.
[1789.38 --> 1791.84] There's a fundamental difference between imperative and declarative.
[1791.84 --> 1795.72] You can see it with SQL versus Go, right?
[1795.82 --> 1801.22] Because SQL, you say, dear database, this is the result that I want.
[1801.30 --> 1813.38] And then the database has a ton of usually very clever implementation to figure out how to get whatever the way that it represents the data on disk into the result that you want.
[1813.78 --> 1814.00] Right?
[1814.06 --> 1818.28] So you can filter, you can join, you can group, you can order, et cetera, et cetera, et cetera.
[1818.28 --> 1824.36] Now, in the FP world, let's just take this map example I keep using.
[1825.10 --> 1825.20] Right?