text
stringlengths
0
1.36k
[1596.24 --> 1596.96] I'm just kidding.
[1597.60 --> 1598.56] That's the thing.
[1598.56 --> 1603.44] Like now that I don't write a ton of production code, I can do whatever I want.
[1603.68 --> 1608.22] So nothing makes me angry because if it does, I'll just do it a different way.
[1608.34 --> 1615.84] So I'm pretty much indifferent about, you know, arguments in regards to like code preferences.
[1615.84 --> 1618.90] As long as it works, I'm happy with it.
[1619.60 --> 1623.46] We're not going to have very good arguments on this podcast if everybody's above arguing.
[1623.46 --> 1628.52] I mean, I'll argue, but not about this.
[1628.52 --> 1629.52] Yeah.
[1629.52 --> 1630.36] Yeah.
[1630.36 --> 1630.44] Yeah.
[1630.44 --> 1630.52] Yeah.
[1630.52 --> 1637.96] Uh, the question on our chat in Slack, you can join the changelog Slack and the JS Party
[1637.96 --> 1639.06] channel.
[1639.06 --> 1644.28] Uh, Seth Adder asked, is there any argument against a second weight other than performance
[1644.28 --> 1645.86] and syntax sugar is bad?
[1645.86 --> 1651.84] Um, eating well against a second weight, maybe not because it's just sugar.
[1651.84 --> 1658.28] Uh, but there are plenty of more arguments against promises than just, uh, performance,
[1658.28 --> 1664.72] namely error handling, uh, I think is, is the number one complaint, uh, that whenever you're
[1664.72 --> 1672.48] inside of, um, promises, oftentimes you're many levels deep inside ends and, and, and stuff
[1672.48 --> 1678.42] and, uh, errors can get swallowed, uh, you know, in a way that it's very, very hard to
[1678.42 --> 1679.16] track them down.
[1679.16 --> 1683.20] Um, and very hard to even get stack traces back out of them when you do catch them.
[1683.20 --> 1688.56] So you need to be very explicit about every error step along the path.
[1688.78 --> 1693.00] And if you're not, then things just get swallowed and you don't realize that bad things are happening in your code.
[1693.42 --> 1704.06] So I think that's it may not be the number one like design flaw with them, but it's certainly the number one like thing people run into whenever they set up a giant promise based system.
[1704.06 --> 1714.02] Yeah. And I think also like the way that it handles errors kind of conflicts with the way that not just node handles errors, because that wouldn't be accurate.
[1714.12 --> 1724.00] Node doesn't have like a way to handle errors, but a lot of the debugging facilities and tracing facilities in node rely on errors and exceptions kind of bubbling up to the top.
[1724.70 --> 1729.08] And so because it's swallowing them, you lose a lot of the state and you can't figure out where you're going.
[1729.08 --> 1733.34] So a lot of like production node systems have have issues with that particular mode.
[1733.34 --> 1736.50] And that's that's being worked on. Right. Like this is all really, really early days.
[1736.60 --> 1739.40] So I think that all of this is going to get better over time.
[1740.30 --> 1744.18] But people that are, you know, already have a big production system kind of don't like this.
[1744.26 --> 1751.54] I think there's also a style argument or a way that people like to to write code argument.
[1751.54 --> 1757.82] And it's the argument. This argument is as old as time, which is just a kind of OO versus functional programming argument.
[1757.82 --> 1765.86] And essentially promises, you know, wrap up a bunch of state in this object abstraction that you can then stack and compose.
[1766.44 --> 1771.78] And some people think that that is a bad style of writing code compared to more functional programming style.
[1772.22 --> 1774.30] And so there's that argument out there as well.
[1774.78 --> 1782.72] And I think that like people have different brains and different people's brains like these different ways of writing code.
[1782.72 --> 1792.00] Sure. So so Seth also asked, is there a suggestion for avoiding like the error stuff and some of these other gotchas?
[1792.00 --> 1794.18] And I don't think there's a great one.
[1794.32 --> 1802.86] Like there are good like baseline rules for how to not write promises in a way that that accidentally swallow errors.
[1802.86 --> 1810.14] But in practice, like with some of the most brilliant people, like it still happens almost every time once or twice somewhere.
[1811.68 --> 1815.90] So there are other mechanisms for asynchronous coding.
[1816.04 --> 1823.18] So the baseline won't be callbacks, but then you you get to what people hate about callbacks, which is callback hell or whatever.
[1823.56 --> 1831.10] I'm sure Michael has some things to say about callback hell, but I don't think he can deny that callback hell exists for some people.
[1831.10 --> 1841.26] But then there are other async mechanisms like async functions are coming in the future, which is a pretty fundamentally different model.
[1841.78 --> 1855.14] And then generators, if if you know that model or another way to kind of yield control in certain sections and then and then pop back back to those.
[1855.14 --> 1865.84] Not necessarily used in the same exact ways, but generators and async functions are kind of cool because they make they don't swallow errors in the same way.
[1866.10 --> 1873.16] And they make programming asynchronously look somewhat synchronous, which is which is pretty cool.
[1873.16 --> 1888.98] They are also because of that can be very confusing because you don't realize it's very hard to stretch your brain to say like, oh, this one character here, this one keyword caused all this stuff to happen behind the scenes.
[1889.32 --> 1892.66] And so they can be somewhat difficult to reason about sometimes.
[1893.12 --> 1896.14] Maybe Michael has more opinions on generators and async functions, though.
[1896.14 --> 1911.74] Yeah, I mean, I think I think before we go too deep into this, though, I just want to point out that in the browser, there's actually some new features around promises and for error tracking and handling specific promises that I believe actually rely on the native promises.
[1912.74 --> 1919.74] So for debugging the promises, though, it wouldn't be like your code would still swallow it, but you might be able to see it in your tooling.
[1919.74 --> 1920.70] Does that make sense?
[1921.08 --> 1921.68] Right, right, right.
[1921.74 --> 1922.50] Exactly, exactly.
[1922.96 --> 1933.38] But honestly, I mean, so the solution to callback hell is to write code that doesn't have callback hell the same way that the way to not swallow errors and promises to write code in a way that doesn't swallow the errors.
[1933.72 --> 1937.58] Yeah, so it's not necessarily a good solution, but it's viable.
[1938.42 --> 1938.60] Yeah.
[1939.34 --> 1941.06] I'll also say just about coroutines.
[1941.26 --> 1948.28] There's a library called co that is the main thing that people use on the node side to really do a lot of the asynchronous programming using generators.
[1948.28 --> 1957.52] And it's not in super wide use generally, but it has this huge following in China, really big.
[1959.38 --> 1960.68] It's actually really interesting.
[1961.00 --> 1972.22] So there's this dude, Dead Horse, on GitHub, but he took over maintaining some of TJ Holloway Chuck's modules when TJ left.
[1972.60 --> 1973.38] As we all did.
[1973.94 --> 1975.64] Quit for Go, you know, as you do.
[1975.64 --> 1983.76] And but yeah, he took over a lot of the co stuff and Dead Horse is actually like a really well known programmer in China.
[1983.98 --> 1988.34] He he helps with some of the CNote and CNPM local stuff.
[1988.94 --> 1990.74] He's actually a great dude.
[1990.84 --> 1991.86] I met him when I went out to China.
[1991.86 --> 2000.32] But because he's such a presence there, I think that he has sort of like, you know, by himself kind of propped up the coroutine stuff.
[2000.60 --> 2003.76] And a lot of the people in a lot of programmers in China are actually using that.
[2003.98 --> 2005.88] Like there's there's not as big of a promise following there.
[2005.96 --> 2007.42] And it's much more around the coast stuff.
[2007.48 --> 2008.32] It's a really interesting.
[2008.80 --> 2014.16] It's one of the few like divergences in preferences that I know that are actually like geographic.
[2014.42 --> 2015.08] Geographically based.
[2015.08 --> 2015.60] Yeah.
[2015.96 --> 2018.38] I actually only use the async module.
[2020.64 --> 2022.54] That's kind of not maintained anymore.
[2022.84 --> 2025.86] Oh, that was not not true.
[2026.00 --> 2028.20] But back in the day, that was somewhat revolutionary.
[2028.20 --> 2038.04] Like, I think some of people's love for promises came out of kind of the bridge between promises and callbacks that async was.
[2038.10 --> 2049.44] It was like this weird middle ground where you didn't have to, you know, count the number of different things that had finished or introduce like multiple layers of callbacks in a row.
[2049.52 --> 2054.38] You could kind of use the async module to to flatten some of those things.
[2054.38 --> 2063.36] But it definitely wasn't by any means like a standard or even internally consistent in how it worked.
[2063.46 --> 2068.62] But it was it was nice from a from a community growth standpoint.
[2068.74 --> 2069.78] It was a stepping stone.
[2070.78 --> 2072.18] So, yeah, yeah.
[2072.22 --> 2081.28] I think like in the server space and in the front end space, if you get popular enough, somebody will make a promise version of your thing and there will be like a following around that.
[2081.28 --> 2082.92] Like there's definitely a lot for request.
[2083.40 --> 2083.56] Yeah.
[2083.76 --> 2083.92] Yeah.
[2084.38 --> 2093.28] But I'm actually curious, Rachel, if you see this in the hardware space at all, if like there are if there are as much of a problem that's following in node bots and whatnot.
[2094.38 --> 2101.34] Um, I honestly couldn't tell you because I live in such a siloed thing.
[2101.34 --> 2109.76] And I mean, most of the well, a lot of the node bot stuff is very single usage thing.
[2109.76 --> 2114.58] So you'll have like one sensor being controlled by some other input.
[2114.58 --> 2122.30] So there's not a lot of need for a ton of promises or stuff that you would need to have something special.