mergeconflict355 === [00:00:00] James: Frank. Frank. Frank. Frank. Frank. Frank. Frank. Frank. Frank, Frank, Frank. We're back. Ooh. And we're on YouTube. Did you? On YouTube, Frank? Uh, [00:00:16] Frank: are you saying I should have put pants on? Cause maybe I should have put pants on? [00:00:20] James: Well, you know, Frank, you haven't worn pants in years, so no need because we are live and just like any Zoom call teams, call any podcast, any video, you only see our beautiful faces. But now you can actually see our faces. Last week I did an experiment to see, does anyone on the list do a podcast on YouTube? And a few people did. So I said, let's use the power of free Zen cast. And turn on and starlink. Oh, and turn on our webcams. And now it's happening, [00:00:48] Frank: Frank. See, I just like the idea of releasing these videos on YouTube, and I just wanted to make sure we didn't have one of those static screens that just burns into your tv. I already have so much burn in on every screen I have from YouTube static screen, so I'm just happy, even if it's our boring faces. Hi everyone. It's our boring faces. Good to. [00:01:07] James: Hello, I'm James, and that's Frank. Whoa. We recorded this podcast for 355 episodes. Frank, did you believe it? [00:01:14] Frank: No, I don't. You're making it up. Ah, it's not possible. Well, Frank, nobody else is impossible. [00:01:21] James: What, what's impossible? [00:01:22] Frank: What else, Frank? The, the, the current version of C Sharp or the next version of C Sharp? James, do you know, can you even possibly guess at what the next version number is gonna be for C Sharp [00:01:32] James: 28? [00:01:34] Frank: Yeah, it feels like it, buddy. It feels like it. Uh, I believe we are up to 12th, sir. Good thing. I work at Microsoft and you don't. So one of us knows these things. [00:01:45] James: Well, I, for a fact over here have been adopting newer features of C sharp 11, C sharp 10, and my applications, I only really get off to the ground running. We've talked about this in the previous episodes when, uh, when. The editor starts to improve my code for me. Okay. And if, uh, what's that thing? Co-pilot. If co-pilot starts to write better code for me, I get to learn it better as well. One thing I did, I've been starting to use naturally is local functions. I just, I use them all the time and I use them a lot because of, um, of just how I started to program in the. Um, single file in just a council application, you know, they're all in there. Yeah. They're all kind of local functions then. Maybe not. I don't know what they are. Yeah, they are. But, but be because of that, it, it started having me think of programming a little bit different in my normal applications, you know, and that's been around for like ever. So sometimes, you know, you don't have to adopt all the latest and greatest features. It's like that whenever someone puts out a line, a sample of code, and they. Oh, like there's 5 billion ways of doing this. Yeah. And they're all pretty much correct. I mean, maybe some are more performant, but I dunno, it's all compiled and it's probably pretty smart, so it probably doesn't really matter. But I am starting to adopt new things. Like I use string literals a lot. I do a lot of like different j s o stuff, uh, in general and just new pattern matching. But yes, C sharp 12 preview features are here. I don't even know what that means, Frank. The previews of a feature in C sharp. and.net eight, I [00:03:19] Frank: guess. Done any? Eight. Eight. Eight. Gosh. Three. Eight. Eight. The one that runs on 1.44 megabytes. I, I wanna run that. Eighth one. Whiskey good. 12. [00:03:28] James: Oh my goodness. Yeah. The question is, if you start 12 features will, it will no longer found on a floppy desk. [00:03:34] Frank: Well, I've been living in the past, honestly, a bit because it's taken me a while to port my apps from Samin. And only now am I getting to a place where the majority of my code is in.net seven. Now. I kind of missed.net six. I've been jumping straight to.net seven, and so that got me up to what, like C sharp 11. Right. So that's been pretty good, just starting to adopt those kinds of features and things. Uh, I, I, I do a lot of local functions also. I think it's just good for the name space. Just keeping the, just keeping the class clean. Just yeah, keeping those little guys out of the way. Plus honestly, they make the, um, they make like functional programming better to give names to things because otherwise you're just doing lambdas everywhere. And we're gonna talk about Lambdas today, but. Yeah, a lot of lambdas, they get a little bit much, uh, too many of 'em and those kinds of things. Uh, and you're also right about the tooling. My favorite feature is, and it's funny vs. Code doesn't do this, but Visual Studio for Mac does this. If you go to a name space and put a semicolon, it automatically removes the curlys and ente the code. It's no big deal. I can go delete a curie here, a curie there, and reinvent the code. Love it. I just opened files and hit the colon semi. I'm like, yeah, yeah. Look at me. See Sharp. I love ITing or tending out me. I don't [00:04:50] James: even remember My favorite. My favorite thing. There's so many favorite things that happen in, just like you're talking about is when I do demos and presentations and you add a new file, it often does the older style because it's like backwards compatibility mode. Yeah. A template and I'm. I'm like, oh, let me just fix this really quick. You know? And then like, also like remove all the name space. So it's just, it's just a name space and like it's just empty and like, oh, lemme just fix this really quick. And yeah, just make it all pretty. Uh, and that's one of my favorite things to do cuz you just say, let me fix it. And you just add that semicolon and it's like, And done. And it's just magical and it's a beautiful thing. Or like, um, implicit usings, like the global usings where you can just like right click. And of course Visual Studio's been able to clean up name spaces forever. But just when you do that and just like it's do it throughout my whole project, it's like blows 'em all away. It's great. [00:05:38] Frank: Yeah. The one part where I'm having a little bit trouble, normally all the people who complain, oh, there's three ways to do the same thing. I'm with you. I don't care about them. I'm like, yeah, give me, gimme a fourth way, gimme a fifth way. You know, get it right. Keep giving me ways until it's right. But I am getting annoyed with one thing I, because I find I question myself now in code. You know how we used to just write. If variable is equals, equals null, then do this, otherwise do that. The, the innocent little null check James. Mm-hmm. First it became, well we shouldn't do that because you can overload the equals equals operator and who knows what that's gonna do. So you should instead do is object and you're like, That's, that's fascinating, huh? Yeah. Check that out. Yeah. And then they introduced is curly cur, and you're like, huh, that's idio Matt. Or a little weird, but I, I guess I can go with that. And then they're like, is not object. You're like, okay. Not okay. I, I thought not was the exclamation point, but I guess nots a thing now and then they're like, Is is not squiggly. And you're like, what? What are you doing now? And then the James just to, and then they're like, you thought object was weird? What about na? And you're like, it should have been null all the time. So now you can say is Nael is not Nall. And so now there's like, I don't know, depending on how you count six to a thousand different ways to check for Noel and you. So that's a little weird, but, or I'm okay with most of the. [00:07:03] James: And it's also not only just CH changes, the C sharp syntax also to Donna itself. I was actually just a monkey cash my caching library and someone was using it for, uh, a really complex use case, but they were doing lots and lots of caching really, really fast on multiple threads. And there's one thing I'm not really good at, Frank, which is. Multiple threads. I like one thread and I like it when it's on the ui. Uh, so, so, uh, there, there's the file system cash that my, my, my app has. And, um, this one John Dick implemented, I'm gonna throw all the shade on John Dick, but he was doing an md, uh, MD five dot create and then using that, um, to compute hash later on. That is not thread safe. However, in.net five, they, I. MD five hash data. So MD five oh and that is thread state. So boom, I was able to upgrade that and it's backwards compatible and it will generate the same stuff obviously. So it's there and it's confirmed by the engineers. It's actually really cool. Um, and, and you don't have [00:08:05] Frank: to do that. Awkward little allocation. I know it wasn't a big allocation, but it was just awkward that I had to allocate an object in order to do an MD five. Mm-hmm. So you don't have to do that anymore. I mean, no allocation, the hoods, [00:08:16] James: but who knows. Yeah. No, that's good. It's all, it's all done. There's a whole thread here. I'll link it into the show notes. Um, yeah, Kevin Jones, who works as product security and cryptography at GitHub and on the do on net, I guess maybe at GitHub and on net. I don't know what he does. No, he does everything. So, um, [00:08:35] Frank: When was that introduced? Uh, I sorry, rabbit hole. Uh, that's fun because I MD five all the time, so Don five. It's done in five. Yeah. Been a while, huh? Yeah. Okay. Just sitting around not using it, but it's [00:08:49] James: okay. It's okay. Like that's, that's one thing. Before we jump with the, I'll wanna let our listeners know. Our viewers know it's okay. It's okay. You're gonna go to conferences, you're gonna see videos about the latest. And greatest stuff. Right. It's okay. You don't, that's fine. You don't have to use this stuff and it's not bad. You don't use this stuff. I, you know, for years, right? In the za early Zamarin days, we didn't get to use Async Kuwait. We weren't allowed to, right? Was it? Mm-hmm. Mm-hmm. We were not using, we were using old school C Sharp and dot all. You said all this stuff. And then we got it and then we over time moved the code over. Right? And so my code was, it worked, it was just there. So I just left it, you know what I mean? Eventually we, we upgraded, right? And other things did happen so you don't have to use it right away. And obviously that was a limitation, but you know, not anymore. So it's like you move. Eventually over time, you know, and I think that that's okay. Your code's gonna keep working and that is fantastic. However, Frank, I will say this, um, I am actually really, really, really, really, really, really, really, really excited about the, the, the, the big one, if I'm gonna say the big one cuz there's three features. So there's only, maybe they're all big, but this is, to me, this one has the most text in the blog from Kathleen. So I'm gonna say it's the big one, but let's go. Two records. Frank. Mm-hmm. Must and, and [00:10:14] Frank: you, do you use records? Can I, can I tell you James? James. James. I don't use records enough. Yeah. I still write records the longhand way because I started in C Sharp one, and I don't know any better than to just type and type and type and keep typing until the code is running. I, I write, I, I use records, lowercase records all the time. Do I remember to use the record syntax in C Sharp? No, never. Because I need to bake it into my head. I use records all the time in F Sharp. I should be using records all the time in C Sharp, but I'm just a big dummy. Everyone. Everyone. Let's use records because they're a great immutable data type with an ice. Beautiful thing on it called. A primary instructor? Yes. One and only [00:11:01] James: one way. When, when, when records were introduced and they introduced the primary constructor, it really, really, um, um, sparked a little bit of like co what Kotlin does with some of their classes and they have primary constructors. And I was like, oh, I, I saw that. And, and a lot of people were a Kotlin world and doing android dev and they said, well, look at, look at. Little code I have to write to create a person class. In fact, it's one line of code, right? It's it's a whatever, and you just put the things and it does the things and you're like, oh, you fancy over there? That's, you know, you know. Great. So then records came along and I'm like, this is great, but I wasn't really sure, right? Cuz now we got STRs, we got classes, we got records. I'm like, I don't really know which one to. And, and when, um, you know, I, I was already str struggling half the time to use classes and instructs Correct. But classes and instructs didn't get primary instructors, but, um, records didn't. It was really nice. You could then put everything on one line of, of, of, of, of code, and you would have an entire data type. But now Frank c. Everybody gets primary construction. Every, you get a primary constructor. The frank constructor. Everyone gets a primary constructors. Cuz why not classes? STRs. Yeah. Why not? Everyone gets it. Look, [00:12:17] Frank: I, I think this is actually a really good feature and I think it's a long time coming. I think people, when, uh, primary instructors came to record types were all like, yeah, but what about our other classes? We could really use them. So to be clear, a primary instructor. Is basically where you're de defining the constructor and the fields of the class all at once. You're just saying, here's my data type name, and here are the fields slash structor parameters, and it makes those fields for you. Those things are available now within the class in the records. It does an additional thing. It also makes 'em public properties. Uh, that's not gonna happen in your class. So the big difference between the records and the class are you still get this nice terse syntax where you only have to define your fields and your constructor things once, which is really nice. I hate repeating myself. And then you can have what, a swift calls like convenience constructors that then call into that primary constructor. But everything is known to go through that. Nicely named Primary constructor. I, I like this thing a lot. Okay? I, I, before I had a friend who I was teaching C Sharp two, and I'd be like, here's how you define a class. Here's how you define the fields in it. Now here you gotta write a constructor and you gotta re declare all those fields as the parameters. And then inside the body of that, you gotta do this. That equals that this thought fu equals fu. And it was honestly a lot of typing and then editors got better, refactors happened, and then we all got co-pilot and chat G P T, and now that just generates code for us. But it's still so much nicer to only say those things once and only once [00:13:56] James: the end. The game changer here in, in, in this is. This cascades on other C sharp features that have been introduced over the years. They're not new as they're, they're new error, but, you know, being able to set the default value on, um, on a, on a public property, right? You do usually do get set. And then you could, you could assign that to have a default, like string dot empty or zero or what, or an empty list. And that's sort of a game changer because if it wasn't in your constructor, in your constructor, you're like, oh, let me, let me either set the backing field and then I gotta create a backing field. Or I'd have to like create it in the constructor and set the default, the property. But then you could just say like, name get set, and then squigglies equal. James, right? And then you have James. That's your default for every, uh, person or whatever that is created. The cool part here is that these are. Primary constructor parameters, right? So you're right, they're not backing fields. Those aren't generated for you. But there are parameters that are passed in that you can use later on to perhaps like set the defaults, which is actually kind of amazing because what you'd end up doing is exactly what you just said, is you would end up creating this constructor and then assigning all of these public getters and setters over and over again, and you'd have this big, chunky. And, and that and the like. I wish the blog post had it before and after because I, I think that would really be a game, a game changer. You're seeing like, okay, before you, they have a student example that passes an ID name and grades. So what you'd, what they're showing is, hey, this all fits on seven lines of code. Where before it would be like, I dunno, 12, 13 lines of code basing on your white space that you have inside of there. Um, and to me, That is nice because there's no value there, there's not value really. Mm-hmm. In the constructor. Um, some people might say cleanliness, but I say constructors, Frank, they get in my way because, do I put the private variables above the constructor? Do I put it above the public getters and setters? Do I? Yeah. You know, where do I put the getters? Like, where does my constructor end up going? In fact, I don't even want a constructor. Get outta here constructor, because I got primary construction. [00:16:11] Frank: And then even, even if you end up writing a class that has like six different kinds of constructors, because there's a million different ways you can create this kind of data. If you're like me, you generally create another constructor that actually takes in all those different arguments and they all kind of funnel to that one anyway. So I think we all kind of use primary instructors anyway. It, it just ends up that way. You end up with one that does initialize, kind of all the fields and everything. And so this is gonna be quite the time saver. In fact, what I, I did it just yesterday. Um, you type out a class and then I move the cursor up to its name. I hit alt enter, and I say generate constructor, dot, dot, dot. That one's important because there's also a generate constructor, no, dot, dot, dot. In the choices. Mm-hmm. the.dot.one initializes the fields, the other one doesn't. And so it's important when choosing your refactoring, this is all vs. Mac and vs code kind of stuff. I don't know what it's like on Windows, but it's funny, I, I rely heavily on that generate structor refactoring because I don't want to type that thing out. And so you can be rest assured, this is a feature I'm definitely stealing in any code base that I can get onto dot. [00:17:20] James: Now, I guess the, the thing that people would say is like, what if I had a private variable, let's say I was passing in the name, but I had a private variable [00:17:27] Frank: called name. It is private. Oh, it, yeah. Oh, like you declare your own, I'm sure, yeah. I'll just give you a compiler error cuz then you would have two fields. It's, it's hard to say. Um, most likely the backing field will have an identical name to the actual parameter name that you provide in the constructor. Um, but I haven't tried this. [00:17:49] James: Yeah. This says, and I'm gonna read, I'm gonna read from the blog. Okay. The blog says When primary constructor parameters are used in methods or property accessor, um, they need to be captured in order for them to stay around after the constructor is done executing. That makes sense. If you pass them in mm-hmm. You don't do anything with them, they will. Go away. They'll go away. Um, well [00:18:12] Frank: important for a garbage collection, cuz you might think that you're holding a reference, but you may not be. That's so you need to do something to hold. Yeah. [00:18:19] James: And it says this is similar to how parameters and local variables are captured in Lambda expressions, which we're finally gonna talk about here soon. Uh, for primary constructor parameters, the capture is implemented by generating a new private backing field, which you just said on the class or struck itself the field. Unspeakable name, which means we'll not collide with other naming and is not obvious via reflection. Consider how you assign. And use primary constructor's parameter to avoid double storage. The example name on the, on the person or student is used to initialize the auto property capital name, which has its own backing field. If another member referenced the parameter named directly, it would also be stored in its own backing field, leading to an unfortunate duplication. [00:19:07] Frank: Whew. Okay. Everyone be very careful of that. That's an interesting, so I assumed it was gonna generate a field with the same name you just said. It does not. So that is tricky if you wanna support reflection. But these are private fields, so if you're supporting reflection over private fields, you probably have a weird design anyway, so maybe don't use this, but uh, yeah, that sounds a little complicated, but I bet you in practice it's gonna feel fine. I [00:19:33] James: think in practice, you're right, it's, it's probably gonna be fine because when you think about a constructor that you have today, those parameters are actually, uh, mostly throwaway, right? Mm-hmm. Because you're assigning them to your private field. In this case, you could assign it to your private field, or you could set it to the default value of your, you know, public field. And [00:19:54] Frank: if you wanted to definitely hold a reference and definitely capture it under a good name, user record. That's what we go, he is there [00:20:01] James: for. [00:20:01] Frank: Yeah, exactly. And it'll be nice. You'll just switch the word class to record. [00:20:05] James: Boom. Um, I still, I, I think I've been talking to Jeff. We, we, I really need that definitive when to use what, like a video. I'm sure this exists on YouTube. If not, I'm, I'm not smart enough to create it. Mads needs to create it or somebody else needs to create it, but like, You know, record class struck when to use what, you know, record, you know, record. Or sorry, you class instruct heap versus stack. I get it. You know? Mm-hmm. There's other, other things in there, right? That, that's the biggest difference. If anyone asks you if you're taking a coding quiz, um, I will let you figure out what that means from there, if you're not a stack versus heap person. So, no. Um, [00:20:43] Frank: I think of it, no. See, you're talking about an implementation details. I think semantically value type versus entity [00:20:48] James: type. Ooh. Them that, yeah, that's true. You're [00:20:53] Frank: thinking about memory model. There's different ways to look at these things, but they do implement the memory model you mentioned. I [00:20:58] James: guess, you know, what I'm thinking of is, you know that, um, like mastering C Sharp or C sharp in a nutshell book, but it's actually about this big and I'm like, the size of my head is what I'm doing on video for everyone listening on podcast. I read that it was like, um, uh, C sharp, I don't know, four or whatever, and like my first job outta college. Like, and here's, here's, here's how you learn C Sharp. And this is this mega book. And, um, I think I was learning the basics, like the, um, there we go. You wanna talk about Lambda? Let's, let's skip over the next feature in the blog. And since we're talking about Lambdas and how these parameters are similar, Primary S are similar to how these Lambdas work. There's another feature all about Lambdas. Do you wanna dive into this one? Yeah. This one I actually, I'll try to, I didn't, I thought that this already exist. To be [00:21:51] Frank: honest. Okay. I, James, this one weirds me out so much that I, I delayed the show because I'm like, James, I gotta understand these better because this, this is tripping me out. I, I've written IL interpreters, I, I, I know pretty well how the stack executes code and I'm like, they did what now? So let me explain the feature. I'll try to, yeah. Anyway, hi. It's default Lambda parameters C sharp 12. What? A default Lambda parameter? Well, we have our Lambdas, which are in general unnamed functions. It's just a function. It's got acute syntax. You declare the parameters. You use a cute little arrow thing. You either gave it an expression body or you put some curies, and then it acts just like a function. It's an unnamed function. It's all a lambda is. But there's always been one big difference between S and real functions. Well, there's been a lot of differences, but a weird one that I never considered before. Functions can have default parameter values. So that is, uh, if you try to call that function and you don't provide a value for that parameter, it just throws in the default value for that argument. Yeah, a parameter argument, whatever. Uh, yeah. So nice simple feature. It's been around probably since the sharp one feels like it. Old classic feature. It's in addition to overloading because it's really just a cheap way to do overloading. So we don't have to type a million different overloads, but land. Don't support them. Never have supported them because. They're weird. James Lambdas come from F sharp, not F sharp. What am what am I saying? I'm sorry. I just, I showed my bias there. Lambdas come from functional programming and in functional programming, a generally speaking, every function just takes one argument. So there's no, no debate here. But also in general, you know exactly how many uh, arguments a function takes, and you always have to pass that number of arguments to it. Defaults don't really exist. You pass null roughly if you want defaults. And now there's this weird thing, James, I can't quite wrap my head around it, but you can create an unnamed function. Maybe it has three parameters and two of them have default values and therefore you can call it with one to three parameter or argument values. And there's the feature Who, who requested this? James Who, who, who hates functional programming so much that they would request this feature? No, this [00:24:20] James: feature makes 100% sense because if you're, because the reason that these things exist is because you don't want to, if you have three parameters, you don't want to create three lambdas that take in one, two, and three. Uh, parameters in it. You want one that then generates with your IntelliSense and tells you, you basically can do this. You're can have one, two, or three. Like, why it makes sense. I'm like, that's why I was like, does it, to me it's kind of like an in an inline function. It's like a local function to me. You know what I mean? Yeah. It's, it, I should just do, [00:24:55] Frank: it's in use case. Okay. Okay. So in the case of a local function, it makes sense. You declared a local function, you wanted to act like a normal function. Yeah. Fine. But like, where in link does this apply when you're actually passing functions around? Where in tasks does [00:25:12] James: this apply? Oh, this is great. No, this is, no, you're wrong. Okay. And you're wrong. Okay? Mm-hmm. This is, this is great. Imagine you're creating a, a lambda That is that sorts stuff. Mm-hmm. And maybe you want the default to be ascending. Okay. But maybe you want to pass in an enum that allows you to do descend. [00:25:32] Frank: You can do that. Just have a function that returns the function. [00:25:36] James: I'm, I'm just saying, Frank. [00:25:39] Frank: Okay. Let, let me, let me take it from another text so you can understand. Look, sometimes you just look at a painting and you're appalled, and so I'm just trying to explain, uh, my appalled, okay, let me ask this question, James. What is the data type of a lambda [00:25:54] James: uh, var. [00:25:57] Frank: No, sir. Um, magic [00:26:01] James: uniport. Magic butterflies. Yeah. Uh, rainbow. [00:26:05] Frank: Now you, you know what? You can declare 'em as, you can declare 'em as actions, funk or funks. Mm-hmm. Or delegates if you declare your own delicate type mm-hmm. You can cast it to those kinds of things because it was a trick question I was trying to trick you, James. Um, Lambdas have no. The compiler from context decides what type to assign it. And so some time ago, was it C sharp? 10 or 11 ish, I don't even know. Uh, they, they never used to allow VAR for declaring a Lambda. Mm-hmm. You could declare local functions and use VAs inside of them, that kind of thing. But not for a Lambda, not with per peren equals greater than sign. Not with those. And then one year they decided, you know what? We're not, even though lambdas technically have no type, we're just gonna assign the most basic type to them. Hmm. So if they see a Lambda that takes no parameters and returns a value, it's a funk. If it takes a parameter, doesn't return anything, it's an. And then multiple arguments, et cetera. Here's the appalling thing. What is the type of something that takes two parameters? It's an action, T of one, T of two, the two type parameters. So that means when you call it, it needs two arguments. Must T one and t2 or does it, what if it has a D default value? Now, James? I don't know. There, there has to be some magic information encoded at the type level. It is my best guess to make any of this kind of stuff work, and that freaks me out. Because we did live in a very simple world where action and funk were pretty reliable. You could translate mo things. There were other funk things like predicate out there, but most people relied on action and funk. And so I'm just scared of this new world where there's gonna be all these new delegate types out there because there has to be a way for it to declare that, uh, that is a default parameter on [00:28:05] James: that delegate. And you don't think it's just doing something which is like creating two of them, like when you compile it and the compiler just. Doing stuff. The [00:28:13] Frank: needs to know, because you could declare these things in another assembly. It has to be in the il. [00:28:19] James: Hmm. Well then you're gonna, did you look at the implementation to figure out how much does it. [00:28:26] Frank: No, uh, I, I could get, uh, I'm, I'm just gonna assume, I like to assume James, um, delegate types, uh, you know, you know, if you type like delegate void, blah, blah, blah. Yeah. Take some parameters that actually turns into a full class. Oh, so I'm, I'm assuming that the class just gets tagged with a bunch of metadata so that the C sharp compiler knows how to deal with it. A little worried whether F Sharp will know how to deal with that kind of stuff, because not only, um, sorry, I, I skipped, uh, around a little bit there. So not only can the Lambdas have the default parameters, but you need to express that in the type system. And so when you're declaring new delegate types, you can say that that delegate type parameter has a default value also. Does that make sense? So that's why I think it's, uh, it's in there in the IL somewhere. [00:29:14] James: I like this feature. I also like this other feature, Frank. This is mind blowing. I love it. Using directives for additional types. What if Frank, what if Frank, you wanted to type but it didn't exist, and what would you do? I guess you would like create a class. Now you got a new chat, Beche. No, no, I don't do my [00:29:35] Frank: anymore. To me, [00:29:37] James: imagine, imagine you were like, oh, a, a measurement or a, a path, a path of points, or I'm just reading measurement, right? When it takes in units and distance, right? You would, you would create a class or a record or a strt or you would create something, but Frank, what if you didn't have to, and what if you could just create your own types? On the fly, you get an int, you get avol, you double, you get away. Everybody gets their own types. You want types. We got types for days. Actually, this is a really cool feature. I'm not gonna lie about it, because many times, many, well, how many times have you created like a a point, like it's like, you know, point x y, right? Like it, like here's all it is. Well, here you can just say using give a type a name, and then you set it equal to whatever you want it to be. And those things. Be anything pretty much. They can be a tule, for example. That's mostly what you'd probably be using. That's the one that's blowing your mind. Yeah, the tuple. The tule is what's really using your neck. The blowing your my mind and just, you don't even have to give them names, you can just give 'em types. Right. You can say, yeah. Oh, measurement string int. Or you can do measurement string units int distance and it's like, cool, I got you bro. Like done. Okay. You know what I mean? And then you can just pass that in anywhere. It's just a type you, everybody gets a type who doesn't want types. [00:30:57] Frank: I, I, I can't believe you've reduced this feature to such a small example. It, this is so huge, this, this has been a missing feature from C Sharp since version one, version one. We've been asking for this feature. It's called A type death in c plus plus. There's a type out there, but I don't wanna use it by that name. I wanna give it my name. Yeah. It's especially big with generics, you know, like you have observable collection of a tule, of a list of, of a. God knows, you know, you know how they get. Yeah. And you start co I was doing that just today. I was copying around this like took a half full line, this, this one data type. And yes, I know I should go create a class and stop using Twofolds everywhere, but no, no parentheses are really easy to type and uh, but it is frustrating copying and pasting that type all around. So finally we have type deaf, whereas using you could only create a name. A very specific type. Non-generic too. Like a very specific one other type. Yeah. Now you can do the crazy things. You could do records and tules and laws and lists and generics and who knows what. Uh, this is long overdue and I will welcome it hugely, especially I'm assuming it's gonna support the global modifier, cuz I could really use that too. But, uh, I'll take it even if it doesn't have the global. [00:32:23] James: It's got to that. That'd be really nice. I'm gonna, Hey, better. I have to double check the, the spec on it. But yeah, that would be super nice. Else. It's just in the class, right? But no, I think that this is, is a game changer for that regard because, Now how I look at it is exactly what you just said. Once, two, once tuple and you didn't have to use the word tuple anymore and have, you know what Value one, value two, whatever. You had real tuple that were just Yeah. You know, string and whatever. [00:32:51] Frank: Gain values. [00:32:52] James: Yeah. Oh, then. Yeah, I, I would have these tules that are, are deep. You, your tules keep growing deep, deep tubes and these tules just grow forever. I dunno, infinite tules, they do, they just keep going. But now your tules have a beautiful name, Frank's magic list, and then, yeah, that's just all it is. And, and then you have to worry about it. So to me, I think this really sort of cleans up the coat and additionally, because if you do create those, specifically tuple in this instance is what I. Um, you're, you can reuse that everywhere throughout your code, and I think that's just gonna make it Absolutely, yeah. Delightful. Uh, yeah, I, I guess I totally forgot that you could just as, yeah. What you said was from c plus plus, I use c plus plus in a long time. Frank, how am I supposed to remember what c plus plus does? [00:33:39] Frank: I know I, but I do miss this feature. Um, sometimes you just don't wanna create a new type, maybe for performance reasons too. Like, I like to cheat around in my code. Um, there's, well, this used to be a bigger deal when it was like Mac versus iOS, but there'd be places where some things were n floats and other things were float 30 twos. So I would often create like, Using at the top that's called like native float. And I would just cast to that and then switch it, switch it around with if desks do do kind of nasty things like this. And this makes doing nasty things easier. So I kind of love it for that. And um, nah, it's not nasty things like it, they should have always allowed you to say like, here is a long generic type, please let me use a shorter name for it. [00:34:24] James: So thank you. And what I'm really hoping for by the way, is. This comes into like a refactoring where Visual Studio is just like this. This should not, oh man, this two bullshit is inappropriate. Let me, let me, can I just, let me just refactor that for you and then in fact, You know, if, if co-pilot is writing your code, it could, it could give you the thing and then write the using up top for you. Now that would be pretty important. Lemme [00:34:49] Frank: just do all the things. You know, it's funny, even in the beginning of the episode you were mentioning new language features, Andis. I am a little bit concerned that ais are gonna keep us conservative. With our language advancements because MMIS tend to fall back, re revert to the mean, uh, they are gonna, they don't even generate C sharp tent code. They just generate C sharp 6, 7, 8 ish kind of code, which is fine. It's, it's good code. But quite often after it's done generating, you run it through a quick refactoring just to tighten it up with new syntax advancements. And so I am a little bit worried when you get something that's purely syntac, like the, the record thing, like it's, it's a shorter way to write a constructor, uh, primary constructors, I should say, or a shorter way to write the fields in the constructors of a class. These using directors are a shorter way to write out a type name. Uh, they are conveniences for humans. Uhis may not need such conveniences, so I'm a little bit worried that there's gonna be a weird little battle here, especially in this modern era of using these new features. But thankfully we have amazing, um, code analysis engines, and I'm sure those will pick up the slack, but it won't be theis, I don't think, helping us with this kind of, [00:36:00] James: Yeah. What I think you need the AI to do is they need us to write the code and specifically what I think is they need like all the sample code to be updated. Right? Yeah. You know? Yeah. And because of a lot of samples and whoever was writing the sample codes needs to use the modern feature, which means what you're saying is the actual IntelliSense and telecode, that engine, the refactoring will help us get there so they can't modernize. Yeah. Yeah. You, they can't. They're, they're independent and they need to work together somehow. And that's, that's how I see them coming together. Oh, yes, I love it. I'm excited about the, and this, I don't know if they're doing more, I'm assuming they're gonna, there's gonna be more than three features, but at least these are the first three. I actually kinda like that. I kind of like that. If I just want to go mix around with these three features, I could go, just go do that. I don't have like, here's a whole bunch of things, but we'll see what else comes from here. But I'll put a link to the blog. Anything else you wanna say about these features or are you excited? I'm. Uh, [00:36:55] Frank: hashtag Finally, I feel like an apple fanboy like this, this type def man, I've wanted this type def for a long time. So these are, thank you. Thank you for finally giving it to us. These are [00:37:05] James: good, usable features, you know what I mean? Like these are nice quality of life improvements that are, are by no means small features, I'm sure for the team to implement, but they're nice additions. To my lights, [00:37:17] Frank: not making fun of it. But this isn't like Async Enumerables where you're like, well, I just have to rearchitect my app to take advantage of those. Yeah. This is like, oh no, I can use this in my code today. [00:37:27] James: And those to me are the best features at the end of the day. Like there are ones that are like that where like, oh, actually underneath the hood.net is gonna start using these new features and things and all this other stuff. But no, like this is, I can go and use this today. Um, Well, cool. Thank you, Frank. I wanna remind everybody on the internet that you can find us everywhere on the internet. You can find us at merch conflict fm. That's where we're at on the internet. We are ever on an every podcast platform in the world, including YouTube podcast. youtube.com/podcast is where there's podcasts. You probably can't find us there, so you'd have to go to my YouTube youtube.com/jameson magno. I'll put the link down there if you want, but you can see Frank and Us Live. Did you know that? [00:38:06] Frank: I'm, I'm vaguely alive. I 98% alive. Yeah, [00:38:10] James: we're mostly here for you. And we also have Patreons, we got bonus episodes, links in the show notes. Alls of good stuff. And just like we've done for the last 354 episodes, we're gonna end it like this. I was gonna do it for this week's mer conflict. So until next time, uh, I'm James Monte Magno. [00:38:24] Frank: And I'm Frank Krueger. Thanks for listening and watching Peace.