text stringlengths 0 1.36k |
|---|
[116.96 --> 118.16] nobody tells me what to do. |
[118.28 --> 122.78] So I kind of just do what I've always done. |
[122.98 --> 129.60] So I've worked with some things that have the new variable naming and stuff like that. |
[129.62 --> 132.84] But that's really all that I've dipped my toes in. |
[132.94 --> 134.12] And what is the other thing? |
[134.12 --> 135.64] Like let is in there? |
[135.78 --> 136.26] I don't know. |
[136.68 --> 137.28] Enlighten me. |
[137.96 --> 138.76] Let's been there forever. |
[138.76 --> 145.78] I think the big ones for me have been arrow functions and template literals. |
[146.12 --> 147.78] The arrow functions are super cool. |
[147.96 --> 152.16] And I totally get that it helps with readability so much. |
[152.74 --> 156.98] But I'm still stuck in that mindset of forgetting to use it. |
[157.12 --> 160.74] And I feel like if I'm going to incorporate all of the new type of things, |
[160.74 --> 165.30] I'm going to have to enforce it to strict in my code linting. |
[165.30 --> 169.76] But other than that, I'm not actively going out of my way to use it. |
[169.82 --> 172.56] Because nobody tells me what to do when I write code. |
[174.62 --> 176.46] So let me jump in. |
[176.94 --> 182.74] I think I disagree that it makes code more readable. |
[183.08 --> 189.64] I often am looking at typed and arrow function JavaScript. |
[189.64 --> 192.98] So there are types in there and then there are arrow functions. |
[193.18 --> 195.08] And people use implicit returns and stuff. |
[195.50 --> 200.14] And I look at it and it does not look recognizable to me. |
[200.54 --> 202.88] I'm smart enough to figure it out or whatever. |
[203.00 --> 205.40] But I can no longer scan it the same way. |
[205.52 --> 205.88] I don't know. |
[205.94 --> 207.80] It's just a skill that you can do. |
[208.26 --> 211.56] I'm lucky enough that a lot of the stuff that I work on is fairly small. |
[211.78 --> 214.40] So when it's much smaller scale, I think it's readable. |
[214.40 --> 220.46] But I could totally get if you're looking at larger systems where you would be scanning through a lot of lines, |
[220.52 --> 222.92] it would be kind of hard to pattern match. |
[224.24 --> 229.44] It certainly encourages unnamed functions for one thing. |
[229.98 --> 231.44] Yeah, that's true. |
[231.80 --> 233.68] I don't like anonymous functions. |
[233.90 --> 235.92] I like to try and name everything if I can. |
[236.74 --> 237.18] I don't know. |
[237.18 --> 249.10] I mean, they've gotten so small and so kind of easy to use that I'm able to use them in ways that you wouldn't use functions before because it would just be too verbose. |
[249.44 --> 249.54] Right. |
[250.10 --> 260.96] There's a couple libraries that I've written for like templatized HTML and using functions inside of a template literal and stuff like that. |
[261.00 --> 263.10] Like that would have just been too verbose beforehand. |
[263.42 --> 263.56] Right. |
[264.14 --> 264.42] Sure. |
[264.42 --> 276.36] And I think I mean, I was certainly one of those people like I mean, you can dig up me saying this, that like the problem with arrow functions is that it's just a bunch of extra semantics that you have to keep in your head, which is true. |
[276.36 --> 277.42] Like it is. |
[277.88 --> 283.22] And like to your point, Alex, it's certainly not as easily readable as the word function. |
[283.38 --> 284.98] It's pretty clear what that is. |
[285.26 --> 287.14] This arrow thing could be anything. |
[287.14 --> 287.46] Right. |
[287.78 --> 292.34] And so it is more semantics you have to keep in your head like like any other language rule. |
[292.34 --> 295.96] So, but the net of semantics, the semantics. |
[296.16 --> 297.56] So just sorry to interrupt. |
[297.72 --> 304.40] The semantics are are maybe easier because it's just like it's we talked about this a little bit where you're gone. |
[304.40 --> 312.08] It is kind of just literal scope of the variables. |
[312.14 --> 312.88] There's no bound. |
[314.00 --> 316.34] It's just lexical scope of variables. |
[316.34 --> 326.98] So you can reason about what a variable or what this is much more simply because it's impossible for it to be anything but lexical, lexically bound. |
[326.98 --> 334.16] So to some degree, like you can forget about some things that functions add. |
[334.54 --> 340.44] And then to another degree, like it's hard to scan maybe, especially with implicit returns. |
[341.14 --> 341.24] Yeah. |
[341.34 --> 341.46] Yeah. |
[341.46 --> 348.78] I was just going to say whatever sort of complexity they they take take out of the pool by by by not having this. |
[348.78 --> 351.24] Um, they probably add it with the implicit return stuff. |
[351.34 --> 363.58] But so I'm I don't know if you saw this or not, but there was a, uh, a post that somebody did where he was essentially saying that his his style guide now is that he no longer uses the function keyword ever. |
[363.58 --> 365.64] So he doesn't use old style functions anywhere. |
[365.64 --> 373.72] Um, everything is arrow functions, um, and classes, um, have like a different new function syntax for properties. |
[373.72 --> 380.62] And so he uses those when when you would have traditionally used, um, functions for any kind of prototypal stuff or or referencing this. |
[380.62 --> 382.12] Um, and I'm curious. |
[382.78 --> 387.50] Is this just for like personal projects or is this like in practice in his job? |
[388.18 --> 389.26] Or you do not know? |
[389.50 --> 390.24] I think both. |
[390.40 --> 390.92] I think both. |
[390.92 --> 395.74] I mean, he's certainly advocating it to other people, which I assume, you know, would also be for production use. |
[395.90 --> 403.86] But I think that the argument that this actually can reduce complexity if you stop using older syntax is one that comes up a lot. |
[403.92 --> 404.70] Like people talk about. |
[405.14 --> 405.34] Yeah. |
[405.52 --> 409.82] You know, like like eventually the language does get simpler if we can stop using some of these older forms. |
[410.00 --> 413.28] Um, and this is this is certainly, you know, somebody advocating for that. |
[413.28 --> 423.44] But so the, the primary rift I had with the person at my company who felt the same was that I was thinking of functions as the default and arrows as the sugar. |
[423.44 --> 435.50] And he was thinking of arrows as the default and functions as the sugar because arrows are other than in implicit returns are simpler in the sense that they can't be bound. |
[435.70 --> 445.22] And so he's like, well, why would we use the more complex one that can have all these weird binding situations instead of using the default arrow functions, which are lexically bound. |
[445.22 --> 446.40] And so you always know. |
[446.94 --> 452.32] And so like, for me, an unbound function keyword is fine. |
[452.82 --> 456.96] Like an unbound function is fine because like, I'm just not using this inside of it. |
[457.02 --> 462.94] But for him, it's like, why would you use the thing that could be bound when you could just use the thing that's always lexically bound. |
[463.34 --> 473.88] And so it's an interesting like perspective of once you kind of switch over, like seeing the arrows as the default and the function as like this thing that can be different. |
[473.88 --> 490.28] The problem is that, so even, I forgot who you said does this, but the class functions, if you just use the syntax inside classes where you do, you know, a class and then you just tab inside the blocks and you do function name. |
[491.34 --> 492.92] That is not an arrow function. |
[493.12 --> 494.16] It's not lexically bound. |
[494.16 --> 504.88] And you have to do function name equals open parens arrow function function in order to get a lexically bound function in there. |
[504.94 --> 507.52] So it's actually like you kind of have to modify some of that syntax. |
[508.06 --> 514.58] And then like if you decide, okay, I'm always going to use that syntax, like the constructor inside of there can't be listed like that. |
[514.64 --> 516.00] You have to do the constructor the old way. |
[516.00 --> 524.12] And so it could be bound, but you can't find constructors and then like a whole bunch of things like that start getting weird. |
[524.80 --> 528.10] Well, in the case of classes, though, you often do want to reference this, though. |
[528.18 --> 529.24] Like you have a use for that. |
[529.36 --> 532.92] I think that what he was saying was that we can take the function keyword out of it at least. |
[533.08 --> 534.54] And then we can not have this ambiguity. |
[534.80 --> 535.32] Yeah, no. |
[535.42 --> 540.00] So what I'm saying is that if you use arrow functions, the functions can't be rebound. |
[540.00 --> 549.62] It's guaranteed to be lexically bound, whereas if you use just the class syntax, it more mimics using the function keyword. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.