mergeconflict285 === [00:00:00] James: Frank adjusts deleted 80 gigs of new gear packages from my machine. [00:00:15] Frank: Uh, oh man, we need a visual studio extension that just does it, you know, like, is there one, [00:00:22] James: I think it's. Uh, in fact, I remember I'm pretty I'm 95%. Sure. I'm going to go in. Yeah. Look at this. There's literally a button in visual studio under the new gear package manager says clear all new gate. [00:00:35] Frank: Wow. Okay. So that's great. Yeah, that's probably good because I used to understand the dot nougat. It's called dot nougat on Mac. I don't know where it is on windows. I used to understand that directory layout, but all I really know is packages is roughly safe to delete. Yes. Look up. [00:00:54] James: They'll come back. I just deleted. I have, the reason I have so much is because I have three accounts. I have a work account, personal account streaming account, and. You know, they're there. All the new gates are per account. Now maybe there's a way to fix that. And I need to ask the team that, but like, Hey, put this in a global, Hey, can you put all my new gets in this, um, in this SSD that's off on the other side. Do you know what I mean? That's what I should actually ask them. It's a good idea. That would [00:01:19] Frank: probably be easy at, sorry, on Mac. You could just do a SIM link, um, on over to it. That would probably work pretty. Thanks. Pro tip pro tip send link my a new get packages. [00:01:32] James: Directory. Yeah, I used to do, I did a blog post a while ago, which is all about how to clear new gates, how to clear all of your OBJ and Ben files, like all these huge things, uh, with a few PowerShell scripts. Um, but yeah, so I just deleted all of them and I claimed them back in the blue I'm back in the. It's [00:01:51] Frank: the problem with scripts. Like I'm sure I've written this script 10 times also. It's just w where, where did I put the scripts? How do I run the scripts through the scripts work on the new computer? I wish I wrote more apps than scripts. I should write more one-off apps that just do things correctly instead of hacking. [00:02:08] James: No, I deleted all these files, but they're all just going to come back Frank. But I do think my problem was is that I've been, this machine is, I mean, I don't think I've cleared my new get history and years probably on this machine. I have these three accounts and I've been having every single preview of not only Don and Maui, but I've done it six and all of the windows STK. So like there's runtimes in there. There's all sorts of stuff in there that makes it quietly. [00:02:34] Frank: Yeah. Yeah. Yeah. The runtimes are surprising. It just downloads runtime sometimes. Yeah, it does. Yeah. They're good. Uh, I was actually surprised you were telling me how many you had and you had. Three times the amount that I had, and I thought I was terrible because I'm actually a little bit afraid of deleting the packages directory, because a lot of my apps reference really old packages, and I'm always worried that someone's gonna like de lists that they're going to left pad me. They're going to delist their package. And then I'm going to be stuck. And the only. It's preserving that right now is my ever-growing packages directory, but I should just stop worrying about that and get on the things. Save that hard drive space. Yes. [00:03:18] James: Save the hard drive space. I mean, that's all sorry. I do. Cause you, you know, you installed so much stuff and then you never use it again, but like there's just files all over the place and we were, we use Zencaster record. That's a no, no. Um, shade on Zencaster we just all bonus podcasts. Our patrons. It was like 20 minutes where we just talked about how your web browser is just caching so much stuff. I mean, just, I was looking at you or looking at your Chrome. I was looking at my edge. Or edge bait, I should say. And I had, you know, 10, 15 gigs of stuff. Cause we record a lot of podcasts and those are all cashed. For some reason, they're all there. I don't need them anymore more, but they're all there. Five years later, [00:03:58] Frank: web apps are apps. Apps have to put data somewhere. And unfortunately the ephemeral nature of web apps, I don't think they always clean up after themselves. There's there's no reason Zencaster needs to be leaving all those files around there. I've written apps where the very first thing it does probably as a, as a background task, but very first thing it does is run like a garbage collection and step and just goes and looks for stuff to go delete just to keep. The app itself nice and tidy podcast steps do that because you can always get like spurious downloads and things like that. And you can use the caches directory on, um, Mac and iOS. And I'm sure on windows, I forget what it's called on windows, but, um, those don't get deleted that often. So they still take up a lot of space. [00:04:48] James: I don't, I don't let my machine get that far down that it needs to. Have you ever had a machine? We know we have a topic for today, but have you ever had a machine. Run out of disc space. Like [00:04:58] Frank: yeah, no, my machine yesterday, I, I almost filed a Xamarin bug because I could not install the Xamarin iOS update from visual studio for Mac and the package thing or the package updater uh, well, it was trying to install two things. The profile earns Amarin iOS. They were the last two things that need to be installed and the packages, everything would progress by our progress bar and either just vans. Which great. Or it would progress per our progress bar and then say, package could not be installed. I'm like, what is this? Blah, blah, blah. And, um, I forgot what finally told me, oh, you know what happened? I went to the Xamarin website, sorry, the Microsoft website to download the big installer because I figured, well, my installation must just. So I'll go get the actual, real big installer downloaded that ran it. Fortunately that installer at the very beginning does, um, a hard drive check check, how much space you have. And it's like, dude, you're all out of space. We can't put Xamarin on here. And I'm like, oh, so that's what sent me down a long path of finding junk to delete. [00:06:06] James: That'll do it. Yeah, I have. I've now changed. So like visual studio creates all my projects on my, um, I have like a, I have my main, uh, hard drive and then I have like an external SSD. That's a lot bigger. All my videos are recorded on the other SSD and then all of my projects and get up are all over there. So just for like better management as I'm developing, it's like all that stuff there. And then, and windows, I mapped my one drive and I mapped mine. Desktop and like, you know, downloads folder to the D drive, like the external farther too. It takes a lot of work and not everything respects it here and there. And it makes it really tricky when you open a terminal and you're like, I gotta switch to D and then I got to do this other thing. And like, you know, 'cause you're still worse. Yeah. [00:06:53] Frank: Permissions permissions. So I have a video editor. I like to use DaVinci resolve, but it loves to just write out files everywhere. And it was writing out too many files. So I mapped a directory, you know, onto an external drive. But now. Mack, what am I on Catalina? Whatever. Vaguely newish just absolutely will not let the software, right. Two things, even though all the permissions are bright because it has some weird external disc permission that goes over everything. And even though you give it full disc access, for some reason, it still pops up errors. So permissions [00:07:33] James: for missions. File structures and clearing stuff, even though we just did for seven and a half minutes, we're talking about actual development stuff and continuing on our C-sharp themed shows, we're talking about no ability. [00:07:50] Frank: Yeah. So th th I wanted to talk about this because we just did an episode on a C-sharp 10 feature, the controversial seashore, 10 features. True. And, um, I've ran into kind of a funny little bug in my own software, a little bit, a bit raw, some old code wasn't compiling. And I ran into what I think is a pretty modern C-sharp feature, but it turns out it's just the C-sharp nine features. So everyone we're still covering C sharp nine. Um, and this one, James is the, is not novel kind of syntax. So we've had, is before for pattern matching. Did you know that you can say is not in pattern matching? [00:08:32] James: Sure. Yeah. Sure, [00:08:34] Frank: sure, sure. Easy [00:08:36] James: peasy. Okay. I think, uh, well there's an his operator, I guess there isn't is not operator. [00:08:42] Frank: Yeah, but it's not the X, right. It's not the exclamation point. It's actually the word [00:08:47] James: not. So do you know what it's, you know what it's officially called? Ooh. Uh, no, it's a negation pack. Wow [00:08:56] Frank: navigation pattern, right? Because the thing to the right of it is a pattern. So I said, no. Nala is like the simplest pattern matching all the, of the bar interesting patterns, or you do the curly braces and the property syntax. I haven't been using those too much in my code there, but they're definitely kind of an F sharp feature and I kind of love them, but I just haven't been putting them in my C sharp code because it feels a little funny, but that's cool. So you could give it a pattern and say, yeah, don't match anything. Whose name is equal to J. Not James Love it. [00:09:27] James: Yes. And I think this came about because, you know, there's always been patterns. If we think about just patterns, these are logical patterns. Um, but you know, C-sharp eight added switch expression patterns. And then there was a rational patterns, logical patterns, property path, there's all these different sort of pattern matching things that enables you to do in your code. So when you are, you know, doing switches, you can do pattern matching. Over it. So for example, when you think of a relational, that is saying like, you know, something is less than a certain dollar amount or number then greater than something, but then logical is the, is, is not, and that's called negation there's conjunctive that's within hand there's disjunctive, which is with. Well, did the, I'm learning so much about patterns, Frank, this is like a great document. I'm going to link it in our Zencaster over here. So good. Um, I'm learning, they're so [00:10:28] Frank: powerful, especially those relations. I add when you said the relations, because that's like, you know, that that's something I've sharped doesn't really have it doesn't have the comparison operators less than, or equal, greater than, or equal or greater, you know, that, that kind of stuff. Those are really definitely interesting. And I always forget whether you should use. Ampersand ampersand or the word. And, but in general, when you're doing patterny stuff, you use the word and use the word or use the word, not, not the logic symbols for those. So the Knoll stuff though, is a little weirder. Yes. Can I tell you about, uh, a breaking change, but Rob little story here. So this all comes down to our old friend CG color. You remember CJ color? Oh, yeah. Core graphics color. It's it's what all the Mac apple platforms use. If you've done apple, you've run into CG color. I had one really innocuous line of code in my code and it said something like there's a CG color variable out there. Let's call it color. And it said, uh, if color equals equals Nall, blah, blah, blah, blah, go on and do stuff. Okay. That's fine. Right, James, it's fine. Um, [00:11:46] James: uh, yeah, that seems good. So this, this object is no. Yeah, yeah. That's not something that sounds correct. That would be before we have like a is type of thing. And in fact, a lot of people, I think again, which we're talking about like last for like performance, like people, like do you use is, or do you use equals equals? Like how do you string string dot empty versus days? And then we come down to it. Doesn't really. [00:12:07] Frank: Well, in this case, it matters. It matters. [00:12:11] James: It doesn't [00:12:11] Frank: matter unless it matters. Well, it mattered so much in this case, but I am changing my style. I am a hundred percent is, uh, in his pattern and this is something, um, Jared Parsons on Twitter, he's part of the compiler team, the C-sharp compiler team. He has very hard promoted that we should all be using his and his. No for NOL checks specifically because of this problem that I ran into. So what happened? Um, whoever maintains CG color decided, you know, what CG color needs an operator overload of the equals equals operator. [00:12:52] James: Oh yes. Yes. Yesterday they implemented equatable, [00:12:56] Frank: correct. Right. And they didn't tell. You know, there's the dot equals that every object has every managed object in C-sharp pass, but then there's the equals equals and they're separate. And that's one of the trickier parts and learning a C-sharp how to handle those two different things. But in the case that equals equals you say that it can be compared to, well, what would you think it can be compared to another CG color object? Yup. Right. But now, now let's put all these great news C sharp, 10 and nine and 10 features together. We have Nala ability checking in C sharp now. And, um, so I run, I, I love knowability. I love reference all abilities. So I run with warnings, turned on to errors and checking all ability. Are you that crazy? Do you, do you run in that mode? [00:13:51] James: Uh, no, you're now all intense. [00:13:55] Frank: Yeah. I'm I'm hardcore. Yeah, for sure. It's good. I want the software quality man. I'm I'm all about the quality. Uh, so what happened was the equals equals operator. Uh, they don't handle the Knoll case even though they, uh, it's annotated it's, it's not annotated, I guess, in this case, it expects to receive a full CG color. Therefore you can not compare when you have no ability checking, you cannot compare a CG color to. Because there is no operator to do that comparison. The default equals equals operator uses dot equals. I think, no, actually I might be wrong there too. So everyone watch out equals is confusing in C sharp, but what this came down to was, uh, the compiler refused to compare color, to know isn't that funny? Oh, interesting. Huh? Yeah, yeah. Huh. Is right. Um, so that's thinks, uh, this is a general rule of when you override the equals equals operator for reference type objects, which CG color was, it can have the value. Now you have to have a version of that, that can kind of take objects or that is comparable to Knowles. So your second parameter must be marked as novel as you know, has to have the little question. And C sharp nine and 10, but without that, the compiler just won't compile it. So what do you do? Well, thank goodness. We have pattern matching and they they've, this, this is a known issue. So you can say color is what was my example of, so in this example it was color is no. Yeah. And then everything works the way expect it's not using the equals equals operator. It just does its thing. [00:15:43] James: Gotcha. Wait, so you have to use is, [00:15:47] Frank: or can't use it. Do you have to use is because if you just leave, if you don't ever define an equals equals operator for your, uh, classes, then they just use dot equals when they do that. And dot equals knows how to handle Knowles. It's it's a part of that spec, so that all works the way you expect. The problem is if you have a reference type object that overrides or overloads one equals equals operator, all of a sudden your knowability stuff is out the window and the safest way to compare objects. To know is to use the new pattern. Matching syntax is no is not know everyone switched to those. I know it's thinks, but this Burt me wants. And you just got to burn me once and I'll, I'm never going to compare to knowledge equals equals ever again. Well, let's talk about that [00:16:40] James: then. So when you decide to use is, or is not specifically, and there's no case, what path does it go down to figure it out? [00:16:50] Frank: It's smart. Um, it, the S the C sharp compiler knows that this will only ever work with a reference type object, and therefore it will only ever do reference equality, basically. Oh, my God, a garbage collector pointer. Got it. So it is the most minimal instruction on the planet. It is fast. There is zero overhead. Jared Parsons. It's very clear. This is even faster than equals equals, equals equals could have all sorts of weird dispatches associated with it. So, um, uh, the pattern matching, although it's kind of powerful syntax, it really does compile down into fast and efficient. [00:17:30] James: Got it. So really, it sounds like the equals equals or dot equals when we want to use that. It's a more of, Hey, does this, does this object actually equal this other object properties normally? [00:17:45] Frank: Yeah, exactly. We call that structural equality and, uh, F sharp where you're going. Yeah. Field by field property by property, making sure that they're equal. And in general, you should only ever do that to strucks and records and C sharp. Most of the time, you don't really override equals, equals and reference type on. Mainly because of this bug or it's not a bug, you know, mainly because of this confusion that it can cause you just don't do it. Um, but sometimes it gets done to very big libraries that you depend on and you can't really change it. And it's hard to make an argument to change it back. So. The workaround is pretty simple, but isn't it weird? Isn't it weird how you can make a breaking change in the most subtle of ways? Yeah, [00:18:33] James: it's a, you wouldn't even think about it. You know what I mean? You're just like, oh, you know, I'm just kind of implement this thing and this makes logistical sense. [00:18:41] Frank: And I, I can't blame the developer either because I would have written the exact same code. I never remember this problem with equals equals, uh, being over overloaded over rideable. I keep changing which one I'm saying. Um, but that that's been a fun thing. Um, So some are more, I think it's all my fault because I run with warnings as errors because other things will happen too in the API. Something that, uh, used to return, not normal, all of a sudden returns nullable because. They realize maybe a binding was incorrect or the annotation was just missed, you know, just an error or something like that. But it breaks my build whenever, like, uh, the main libraries get updated a hundred percent, my fault for running with a warnings turned on with errors or, you know what I mean? Yeah. I still love that setting. [00:19:37] James: Yeah. I feel like, are you also turning nullable on, in all of your applications that enable flag? [00:19:44] Frank: Pretty much. Um, I have so all my old apps, no, I, my old apps are maybe like 20% knowable turned on. It's really nice because in the project you can turn them all off and then file by file. You can turn them on. So little parts. I actually have a policy whenever I get a no reference exception in a piece of code and an old app, I take the time and convert that entire file over to novel. So that's how I've been slowly, progressive lately, um, improving my old apps and honestly finding a ton of bugs because I definitely was wishy washy with how I handled malls. And that's why I'm happy to see no ability turned on by default. And dotnet six, I think that's right. And micah.net, new console. And it's why I'm slowly putting it into my apps. Where the errors were there [00:20:37] James: with errors. Yeah. I mean, that's the important part. You got to have some hairs and they're not a big deal. I mean, yeah. I think that's a great way of doing it. Uh, I have slowly been flipping on as many flags as I can and my apps and, you know, I'm still spinning up some, you know, older xamarinforms projects as well, and I'm deciding. What to flip on what not to flip on. I'm like, Hmm. Well, well, my build server like support that stuff. It should, it should. Yeah. That's the only tricky part. Like, does it have the latest bits it should. Like, because right now we're in a place where I would like to use, you know, implicit usings and C-sharp 10 features, but I'm like, oh, I don't know if app center has the dinette six STK and what I'll do, but all this other stuff, but there's another thing too, you know? And Don has six. There's a new API for checking. No. [00:21:28] Frank: Oh, uh, for what? Tell me more. [00:21:32] James: I don't know if you want to throw an exception. [00:21:35] Frank: Ah, ha I know this one. Um, argument, wait, I can do this argument, exception dot throw with Nall or [00:21:42] James: something like that. Yeah. Argument. No exception dot throw. If not, then give it the object and all, then they will, it will handle it for you now. That's not going to help you in your case because, um, you're checking the is flat. [00:21:55] Frank: In general. Yeah. Yeah. Well worse. I actually got the nail reference exception first. Um, cause obviously I wouldn't have gone back to fix old code. I don't do that, but I actually got an all referenced exception. And then, um, I don't, I didn't want to throw in that code and that code, I was doing our classic caching thing of you. You create it only when you need it. And that's why I was checking for [00:22:17] James: no, I'm talking about NOLs. Swift has an interesting concept called, um, did we talk about this before? We may have, but now we're on the knowability train. So we have, it has an interesting concept called guarding you about guarding. [00:22:35] Frank: Yeah. Yeah. Um, the D language has, uh, also it's a lot like, um, I think of it more like. Well, what, what it really is, it's a backwards if statement, but it's used a lot, like how we use are using statements in C sharp, but it's a backwards. If so, if the logic in it matches, then a shoe, I got it backwards. [00:23:03] James: It's more, it's a backwards. If it's like, you know, only you continue. If not in all, basically. [00:23:12] Frank: Sure it's all like that, but what's yeah. W what's nice about it is if you did your did a whole bunch of nested, if statements, they just kind of look nasty and the alternative to nested nested, if statements is. Early out if statements and things like that. And you do a bunch of early out if statements, all of a sudden, you kind of want the backward syntax for it because you're getting tired of putting, not in front of everything. And so you get guard. Yeah. I S I am curious if C sharp would get it, cause it wouldn't, it, it's not a big feature to add to the language, et cetera. Pretty simple. Part of the compiler, it'd be pretty simple to implement. Um, Yeah. Well, I'm curious, never asked that [00:23:55] James: question. Funny that you mentioned that because there's actually a community toolkit and there is the diagnostics library, which is a dotnet sander library and they have like an MVV MVVM one, this other stuff. So it's not even windows specific. And in here they have guard. And I believe also, I want to say, what's his name? Arlis Steve Smith. I want to say also has a library that also does as maybe reach out to us as well, but this one has it. So this is a good one where you know, this isn't exactly, this is the opposite of what you want to do. But basically they're saying like, you know, it's a weird way of putting it, right? But they're like, here's what your code looks like with all these lines of if statements, but really what you want to do is like, God. You're guarding the bottom of the method against the possibilities of what may happen above. So you're saying guard is not, no guard has eyes greater than or equal to guard is in range. Four guard has size less than equal to guard is not empty or null and you give it things. And as long as it is not, no, it passes the guard, which makes sense. Like, if you think about a guard, the guards like thou shall not pass, unless you are not. No. And then you're like, I'm not, no, I got a whole color over here, man. Let me through. So the guard lets you through. And I first saw this in swift and now, like you said, it probably came from other, other things as well. It seems very popular in swift at least. And I don't know if there's going to become a trend and I think it would become a trend if it did become part of the language. [00:25:33] Frank: Yeah. And speaking of places, I've seen this, um, a language called Eyeful, anyone out there now I fall really cool Lang language. They used to call these, uh, the invariants of this would be the argument in variants, but it's more like you just want a range check all your arguments and it's like that you usually would use title. To restrain the range of possible values, but the types can be just too, too big. You know, you say integer, but really it should be within this more specific range C sharp can't represent that. And it's syntax. Yeah, everyone could look up by fall. Um, but this is, this is, uh, just a quick way of writing all those terrible. If throw, if something throw argument exception. So I actually really dig this. It's just cleaner syntax for all that stuff. And the syntax reminds me a lot of unit testing. Just change the word guard for us, or, and it's just like unit testing. [00:26:31] James: That's true. That's true. The, the swift guarding is a little bit different because it reminds me of more of an if statement because it has the curlies and you can do stuff if the guard is not passed. So you get to decide what the guard does. [00:26:45] Frank: Yeah. And there's an else to the guard, but yes, these are, these are good for just cleaning up, um, your public method, entry points. I don't do this enough. I write it out. Longhand it's spanned out length is less than array dot length. Throw new. Yeah. So this is a good little library. Thank you for that. It's it's fun. These kinds of assertion libraries. Okay. And back to knowability there are all sorts of these cool little, um, attributes you can yeah. Um, the parameters to your functions to say like, if this argument is not all, then my return value is going to be no, if this argument's not in all of them, my return value will be not. No, and it's a way to figure out this kind of dynamic knowability based on arguments. And I'm curious if they went to the effort and the guard library to do all that stuff too. So if you say guard, this is not normal, then that will also enable. Uh, compiler. It's a really sophisticated build system. We have these days, but it's neat how all of these pieces can actually work together. Yeah, it's [00:27:46] James: crazy. It's. Yeah. No. So whoever would've thought that were just deep diving on NOLs nonstop, I mean, they're the bane of our vein vein pain, [00:27:56] Frank: pain, pain, pain Vargas. Um, just like a Batman. Yeah. It's it just makes me. Anytime I get an all reference exception. I just get mad and that's why I have fully embraced the, uh, not fully I'm lying. I've 20% embraced the knowability checks on everything, but overall, it just makes me happy every time. Turn all ability on and a file. I just feel happier because I have some confidence that it's actually gonna work right. Where they call them. No, like the billion dollar mistake at this point, it's probably the 10 or a hundred billion dollar mistake. [00:28:35] James: Something like that. Yeah. [00:28:38] Frank: You can just use that sharp [00:28:39] James: everyone. Do I, do I call the episode and all cause if you call it, no. And it goes into the database. Will [00:28:44] Frank: that be. No, you gotta say is not known that way. The database will be safe. [00:28:48] James: Okay. Yeah. I mean, cause you hear all this, those stories which are accurate, like I think somebody has like the last name of Nala or something like that or something. Yeah. Who knows? Um, yeah, no, no, [00:29:01] Frank: no, no. Well, C-sharp nine features too. I don't know if Noel changed at all in C-sharp 10. Boy was I glad to have that pattern matching because I didn't want to write, you know, dot equals. No, what am I an animal? No, I'm going to write that. You can also say, uh, object dot reference equals and then pass the two arguments. But no, sir, not going to do that either. Yeah, [00:29:27] James: that sounds terrible. I [00:29:29] Frank: have standards. [00:29:32] James: Uh, oh my goodness. Well, [00:29:35] Frank: I bet. Quick episode. No. Well, I [00:29:38] James: think from here on out, I think when he used his not, no, I, I think that you've convinced me though. Cause I, you know, I actually forgot about that feature until you just talked about it now. So I think I'm all in. [00:29:49] Frank: Yeah. I mean, pattern matching in general, I'm still not using it to its fullest. So I'm just taking parts. I'm glad this one bit of it really, really helped me get around a problem that I didn't want to deal with. [00:30:01] James: Sense. I think that's it. 30 minutes on know and file systems also. Thanks to our sponsor. This week, because we forgot to give them a sponsor read in November, seeing fusion that's right. They smelled their last week. And we'll probably talk about them next week to seek fusion handling all of your notes for your automatically. No, I'm just kidding. They have a beautiful UI toolkits and controls for any type of application you're building. Whether it's windows, web, desktop, cross-platform you name it. They have beautiful charts, graphs, controls, pickers, selectors list views, collect views, PDF viewers, edit image, all the things. Good to see confusion.com/emerge conflict. To learn more about all of the amazing sync, fusion controls, things to say, fusion for sponsoring this week's pod and over 85 billion episodes of merge conflict. Oh my goodness. [00:30:53] Frank: Here's to 85 billion more. I [00:30:55] James: don't know. Wait, that's too many. Well, Frank, thanks for talking about know with me. I'm going to go. I actually am going to use it as not normal from now on that's my new default. You're going to [00:31:03] Frank: know [00:31:04] James: on out. And a novel on out of this episode. So till next time, I'm James Watson back now. [00:31:11] Frank: And I'm Frank Crooker. Thanks for listening.