C# 14 with Dustin Campbell - podcast episode cover

C# 14 with Dustin Campbell

Aug 21, 202557 min
--:--
--:--
Download Metacast podcast app
Listen to this episode in Metacast mobile app
Don't just listen to podcasts. Learn from them with transcripts, summaries, and chapters for every episode. Skim, search, and bookmark insights. Learn more

Episode description

What's coming in C#14? Carl and Richard chat with Dustin Campbell about the next version of C#, discussing what it takes to continue advancing software development in the Microsoft ecosystem. Dustin discusses how features are selected from version to version, including long-developed features like extension members, which have been in development for years. The conversation also turns to Razor Pages, which Dustin helps contribute to, and the dynamic of what should be language, what should be framework, and what should be tooling. And there's much more to come!

Transcript

Speaker 1

How'd you like to listen to dot net rocks with no ads?

Speaker 2

Easy?

Speaker 1

Become a patron for just five dollars a month. You get access to a private RSS feed where all the shows.

Speaker 2

Have no ads. Twenty dollars a month.

Speaker 1

We'll get you that and a special dot net Rocks patron mug. Sign up now at Patreon dot dot NetRocks dot com. Hey guess what, it's dot net rocks. I'm Carl Franklin and a Verchard Campbell. Dustin Campbell. No relation is here. He's our guest today.

Speaker 2

I wish I was cool enough to be related to Dustin, honestly.

Speaker 1

Talking to him in a minute. Richard, you remember that when we were on the scott net Rocks tour.

Speaker 2

Yes, we went.

Speaker 1

To that pub and the sign said no Campbell's allowed. Yes, and you sat down in front of the sign and I hung your head and shape we take.

Speaker 2

A picture that turns out actually relating to those Campbell's so right.

Speaker 1

Yeah, yeah, well, let's get started with better no framework, awesome.

Speaker 2

Apart man, what do you got Simon crop, the source of all the amazing Simon Crop.

Speaker 1

Yes, yeah, sources of all good things on the internet. Anyway, found this it's Ziggy Creatures account on GitHub fusion cash. So it's an open source, fast, easy to use, robust hybrid cash with advanced resiliency features. And they even you know, say, you know what about this Microsoft hyper cash hybrid cash that they came out within dot net nine, so they actually addressed that, you know, what's the difference in how can it work together? But these guys got an award

from Google. Oh yeah, in twenty twenty one, fusion cash received the Google Open Source Peer Bonus Award. So you know it does it does all sorts of things right, but resiliency features, performance, scalability features, flexibility, observability like native observability supportvia open telemetry, full sync and async support. Like it's really good. Yeah, and it's all open source and know and learn it, love it, go get it.

Speaker 2

That's pretty cool. Yeah.

Speaker 1

They don't don't try and solve this problem. It is solved totally. You have several options. Don't do it yourself.

Speaker 2

Yeah, So he was talking to us today, Richard Braud the comment off of show eighteen thirty five, which is back in twenty twenty three. We did another show called The Next Sea Sharp, but this was with Mads, I've temporarily called the show the Next Sea Shop, but who knows what's going to happen. We're just beginning to recording

off and change the name after right. And we had a pun of comments on those shows, as usual, because there's lots of See Sharp lovers listen to the show, and when the gods of See Sharp show up to talk to us about it, they have things to say. Yeah. This comment comes from Aaron Morgan, who said, what I love about discards the underscore is that they show intent. I'm a big believer in self documenting code, and discards form part of this toolbox, particularly with returned tuples or,

as Mads mentioned, deconstructors. You don't always want to use all the parameters.

Speaker 1

Yeah, this is the underscore thing that you can return. It's not really returning anything, but it shows that you know something is being returned even though you're not using it.

Speaker 3

Yeah.

Speaker 2

But it's a discard, yeah, discard. Yeah. I understand that they also avoid memory allocation of that variable, although I'm not sure if that later compilers figure out that var isn't used or infers a discard at run time anyway. Yeah, okay, and it might even change as the different versions. This is a couple of versions you go to. I bet you Dustin can probably answer that one. I'm sure you can. So Aaron, thank you so much for commented. A copy of music code By is on its way to you.

And if you'd like a copy of music code to comment on the website at dot rocks dot com or on the facebooks. We publish every show there. And if you comment there and I read on the show, well, don't do your copy used to go by.

Speaker 1

And if you want music to code By but you don't want to comment, just go to music to code by dot net. There's twenty two tracks. Now you can get the collection an MP three, flack or wave format. All right, So before we bring on Dustin, we got to talk about nineteen sixty four because that's our show number. Yeah, and we've been talking about Dustin. We've been talking about what happens, you know, in the years that our show numbers represent. So nineteen sixty four was a big year

for a lot of things. Civil Rights Act was signed yep in past outlawing discrimination based on race, color, religion, sex, or national origin. The Gulf of Tonkin Resolution. The resolution authorized major US involvement in the Vietnam War. So one so far, that's one one positive, one negative. Martin Luther King Junior was awarded the Nobel Peace Prize in nineteen sixty four. On February ninth, the Beatles made their first

appearance on The Ed Sullivan Show, starting American Beatlemania. On February twenty fifth, Cassius Clay announced his name changed to Muhammad Ali after defeating Sonny Liston for the heavyweight boxing title. I'm more kil Sonny Listen, Sonny Listen. I'm gonna knock out Sonny Listen.

Speaker 2

Yeah, he was something else.

Speaker 1

The Ford Mustang was unveiled at the New York World's Fair on April seventeenth, becoming an iconic American car. How about that. The Boston Strangler, the final known murder, occurred in nineteen sixty four, marking the end of a series of crimes that terrorized the city. Kashmir, India backed out of a promise to hold a plebiscite in the disputed territory of Kashmir, escalating tensions in the region. And you know, they've been pretty much at at odds ever since.

Speaker 2

They've been escalated ever since let's be clear.

Speaker 1

Yeah, with a few close calls, if I remember correctly, Yeah, China tested its first atomic bomb, becoming the fifth nation to possess nuclear weapons.

Speaker 2

How about that? Who were the other four? Okay?

Speaker 1

Well, the United States obviously, I'm gonna say Russia, Soviet Union, Soviet Union.

Speaker 3

Yeah.

Speaker 2

Yeah. And let's say who were the other two?

Speaker 1

France and United Kingdom. Oh okay, yeah, of course France, all right? And smoking. US General Surgeon General released a report linking smoking to cancer, influencing public health policies. That happened early in the year. Do you have any computer or otherwise events that you want to talk about?

Speaker 2

A couple of space ones, the first flight of Gemini one, which was an unmanned test flight of that whole stack that would be the for the American missions for long duration in space before the Saturn rockets and Mariner four launches, the first flyby of Mars. On the computer side of things, the first program written and executed written in basic yay, happens in nineteen sixty four. Yeah, Kenedy and Kurtz from Dartmouth. Dartmouth ran on a GE two two five. Although became

rapidly so popular they had to upgrade that machine. Yeah, and what else? Oh, the first mouse prototype so Bail English and Nigola Singlebart out of the Stanford Research Atitude. Although they originally called it the Bug.

Speaker 1

Wait a minute, I thought that was Xerox Park Or did Xerox Park show it to Steve Jobs.

Speaker 2

Integrated it into a full product? This was the prototype? This is before that, before that? Oh okay, yeah, all right, so yeah, initially called the Bug, then later named the Mouse. By the next year and one for you, Carl, Robert Moog demonstrates his first Moog synthesize Wow keyboard with the patch panel with all the effects and within that year the doors will make the song Strange Days featuring the move.

Speaker 1

Did I tell you my Robert Moog story or Mog or how you pronoun So? When I was working at Voyetra Technologies and these guys did the sound blaster and the MIDI interface basically that was there. That's how they got popular. Then they became Turtle Beach. But anyway, I was working for them and doing tech support and we were at a NAM show in Los Angeles and we had a booth and Robert Moog comes over with a young girl who I imagine is his granddaughter. And he says, oh,

this is really neat stuff. Check this out. Can you give us a demo? And he's looking at it and she looks bored to death. Right, She's a thirteen year old girl who would rather be anywhere except with Grandpa synth here, who's gonna take her around all these booths. So I did a demo and stuff, and I saw his badge that it was Robert Moog and so now I'm like, you know.

Speaker 2

Now you're starstruck. I'm gobsmacked.

Speaker 1

Right, Yeah, So I did a demo and then I walked over the lead programmer after and I said, hey, I just gave a demo sequence of plus to Robert Moog. He goes, oh, that guy he comes around every year, so Blase, yeah, he comes around. We give him the same demo every year. So that's my story. That's awesome. If that's all we got, I guess it's time to introduce Dustin. Yeah officially, so dust NEARBIA hasn't changed that much,

but it has a little bit. Dustin Campbell is a principal software architect in dot net Tooling, where he currently works on Razor c Sharp and visual basic language experiences.

Speaker 2

For visual Studio and Visual Studio code.

Speaker 1

Passionate about coding productivity, Dustin's primary focus is on making dot net tooling great and helping design the next version of c sharp as part of the language design team. Prior to his current role, he spent several years working as program manager on Project Rosalind maybe you've heard of that couple times design, Yeah, designing the next generation of the see sharp and vb ID experiences. Dustin is a

programming nut. His favorite color is blue. Well, I notice you have a blue shirt on and I'm wearing blue.

Speaker 2

He's wearing a blue shirt. Yeah, yeah, yeah, Well, welcome back.

Speaker 3

Well, thank you.

Speaker 2

You guys have been busy. I guess huh.

Speaker 3

It's uh yeah, it's always it's always busy times. It's been exceedingly busy lately. So yeah, it's really good.

Speaker 2

We just hit preview six. Granted we're time shifting this, but yeah, I think, yeah, we just did preview six, maybe previous haven by the time this show publishes.

Speaker 3

Yeah, yeah, about there. I honestly the previews probably for many folks that blur. For me, I'm not sure. Yeah, sure, I try and keep my eyes on C sharp fourteen. Right, but even still as kind of features come in from that and get merged into Maine, I'm like, is this feature in this build? I don't remember. It's hard to keep.

Speaker 2

Track, and I appreciate you guys didn't go all superstitions and skip thirden It just shipped with dot net nine, Like, yeah, it did twelve ship with dot net aid And we're not afraid of numbers. Programmers.

Speaker 3

We tried to, you know, we it was a thing. We were like, well, should we do that, because you know, we did it with other things. We've done that before. It wasn't officially for superstitious reasons, but somehow we managed to magically skip thirteen on other things, and we're like, no, no, no, we're going to embrace this.

Speaker 2

Yeah, you skip Windows nine too. That was mostly for compatibility nightmares, right.

Speaker 3

I think that turned out to be painful, But you know.

Speaker 2

I was a very wise choice that we're not going to do a nine because of all the nine X, the ninety five, ninety eight, Like did you just don't?

Speaker 3

Yeah?

Speaker 2

Yeah?

Speaker 3

And it wasn't OS ten envy, right, So yeah, it wasn't actually not no, no, I couldn't.

Speaker 2

Have been no, I'm pretty sure Windows eleven was OS eleven envy, but then you know whatever. You know. I also do the show called Windows Weekly, and I hear this stuff all at time. Yeah, so you're all about fourteen. Yeah, I mean I would think that the previews are important to you just because this is when you sort of put the bits in more people's hands.

Speaker 3

Yeah, and they start to kind of crystallize. I mean really, there's also the moments we have that are like, okay, you know, there's build, you know, there's various events throughout the year. You know, dott a comp comes up where we try and actually, you know, ship the thing weird. But at those moments we try and have like some constellation of features together so that it kind of hangs together.

And then it's about kind of getting feedback, adding enhancement stuff we know that we need to finish up and wrap up or things that are coming later throughout the previews, but yeah, we try and get kind of those moments to be a little more cohesive.

Speaker 1

So and your mads usually do your walk through video about you know, what's new and c sharp.

Speaker 2

I always enjoy those.

Speaker 3

We did that in May. Yeah, we did the What's New in C sharp fourteen, we shared all the and what was great about that was in this case we had everything ready to go in the latest with at least experience in the latest dep seventeen the fourteen preview with seventeen fourteen that went out, so it was you know, you hadn't tellisons on the new features that shipped with the dot net preview then in your hands, so you didn't have to go grab some you know, beta thing

or preview thing. It was right there. I mean you had to get you know, the SDK to build, but the features were there.

Speaker 2

How much of the new features or feedback from the old version and how much are like epics you've been planning for many versions that finally come to fruition.

Speaker 3

Well, in this case, I think most of them are are kind of the longer planning ones for fourteen. You know, we started trying to do this, but in a way

a lot of them are still even this one. I'm thinking about the new extension members feature that's coming, sure, but that's still like, well, we did extension members, you know, fifteen years ago with which with methods only right and C sharp three, so this is kind of like a continuation of that, but we had a really different idea last year, kind of like in C sharp thirteen, of what we thought that would look like, and ended up going back to the drawing board on it and coming

out with something that looks more like what people knew and knew from extension methods already. So in that way, it kind of is a continuation, but also it's been a long, kind of planned sort of thing where we've really had to work very hard and kind of toil a little bit more on the designs.

Speaker 2

And I know it's something we've heard over over again from folks like you and Anders and Mads. It's like, you're really careful about putting a feature into a language because you pretty much can never take it out.

Speaker 3

Every language has kind of a capacity too writ like where you get over that jump the shark moment where it's like, all right, this is too much now, and then you're.

Speaker 2

Like yeah, I was kind of saying.

Speaker 3

Then you're like, you know, then you have to have your good bits moment with JavaScript or your C plus plus, your modern C plus plus moment where you're trying to like shed things that like, Okay, yes this is for legacy, but please don't use this for modern things.

Speaker 1

I was going to say, Dustin, do you have customers and people that provide feedback that you have so many features that kind of overlap, right, and when to use what and how to use what? And I can see people just wanting to exercise the new stuff for the sake of doing it, and you know, the guidance is really important, like here's when you do this, here's when you do not do this.

Speaker 3

Absolutely yeah, and we do get that feedback. It's I was, you know, we were talking about recently. We're like, man c sure one Oh was a way simpler language. It was way clear on how to do a thing because there was just the one way.

Speaker 1

Visual basic forms designer was easy too, because you have no choices, yeah, no options.

Speaker 3

Yeah, and so it was it was, it was. It was easy. You could still do pretty much all the things I mean, but you might write a lot more code to do it. It's just you know, so so in some cases there is that like we need to decide what, like when and why to do something. Sometimes it's it's taste too right, Some things peel to others. Sometimes there's a really important reason to have it go. Let go back to var which is so controversial and I love bringing it up because it just brings controversy

and comments, but still to this day. Right, But it had a very important reason to be there, which was, you know, because you didn't have a way to put a type for an anonymous type if you were putting something into a projection and like a link query, right and a link expression. So that's what they were there for. Functionally, they had to be there. But then they're also kind of convenient, and they're you know, three letters long, which means you put that in a space and now everything

lines up. All your types line up to the tabs if you have your ends set to four and you know, and so they get it could use a lot, and then people get grumpy or people get happy, and and and and so then at that point it becomes like, well, taste or you know, is my program clear? And you have to kind of you know, but you kind of give. We give often it seems like we give people too many I don't know, handguns to shoot themselves in their feet with.

Speaker 2

Sometimes yeah it's not only your foot, it's like here, yeah, try both feet at once.

Speaker 3

We we you know, back in C sharp one, Oh, I know, we were a lot more prescriptive about some

of those kinds of things. An example that comes up a lot we talk about still is like if I recall and I might be wrong about this because things change all the time and they change subtly, but like, at least at the beginning, I know that we were very specific about like no, try catch Finally, they must have braces, right, yeah, they cannot be embedded statements like an if where you can choose to have braces or not, because we felt very prescriptive, like no, you need the

delay nation to see. These are very different contexts and what you're trying to do there, And I think that's still the case today, but we constantly get requests to know, come on, I'm.

Speaker 2

Putting one statement like this is just too much.

Speaker 1

Do you think you guys would be relying more on co pilot agent to be prescriptive about what you're doing? You know, I don't mean like Clippy, but Hay and hey, I noticed that you're trying to do this link statement and it'd probably be a lot easier if you use this method instead of that one. I mean, I mean you're kind of doing that already with for sure, with copilot yeah, we.

Speaker 3

Do it already. I mean I think I think a you know, a coding agent or you know, something you know like like Copilot is going to be, you know,

hopefully doing that. I I also hope that you know, an agent like that is also going to be looking at like the code base you're on, right, So that if I am on a legacy code base and this code base happens to always new up a raised with new erase and tax and doesn't use collection expressions, it doesn't use any of these kinds of things, I would hope it's not saying you should be using collection expressions on this line of code you just wrote, and it's like, no, no,

it should look like the rest of the code, right. And so I would hope that when we get those coding agents that that are, that they're smart enough to kind of keep you in your context too while maybe allowing you to say, you know, I would like suggestions that help me kind of move this forward bit by bit. So I don't know, maybe.

Speaker 2

Because it does strike me with you doing annualships of dot net, like the rate of new versions of c sharp has gone up, and you know, you can still code like it's twenty fifteen, Like it works just fine, you can. And I think it's a question I asked of mad As a number of years ago, just like, how are you going to convince us to use the new syntax? And it's like, I think that's what the tooling's all about, is helping to guide you to more efficient ways to code.

Speaker 3

Yeah, if it's going to cause if it's going to help with efficiency for exam, is a great reason. Right, It's one of the reasons we did a collection expressions.

I I love collection expressions, and that's the square brackets right where you just past things in a square bracket and it picks the type, you know, based on what you're passing it into or what you're assigning it to, and then gives you a type that might be something that was compiler generated, might be just list of T might be you know, array dot empty, depending on what

you're doing with it. And but the point is that that allows me to kind of, you know, allows the compiler at least to be able to be very efficient in what it generates, so we can do things like when you start because those features, that feature also allows for spreads and combining collections together, and it can try and do that as efficiently as possible, and hopefully, you know, it's it's code that like, it ends up making your code look better to do something more efficient, whereas if

you'd written the more efficient way, it would have been a mess. I find that a lot also with list patterns, where if I'm doing a list pattern is somewhat complex, and then I, you know, I start to stray away from it a little bit. But but when I get when I get into a list pattern, I look at the code that it got generated, I'm like, oh, I would never write this. This is way in the weeds. But the compiler is bending over backwards trying to do the most efficient thing at the il level that it

can do. So I mean, that's one of the reasons to kind of go those go with those new things too.

Speaker 2

Visual studio code versus visual studio.

Speaker 3

Which is your favorite? A, oh, well, it depends on the day of the week, Carl, I dog food both. I love visual studio. It is the starship enterprise. However it is. You know, it is a lot. I'm really used to it, and I know keyboard shirtcuts all over the place. I know I can get around it really fast and so I I and and often I'm sometimes I'm also working on visual studio pieces like visual studio components and things that are like, oh, it's it's kind

of easier. I mean, I can debug these things with with VS code as well, but it's like, hey, but I'm doing mixed mode debugging of some old calm thing. I'd rather I'd rather be in visual studio. We're into the tools better.

Speaker 1

I wish the Razor code editor was better Razor file Code Editor.

Speaker 3

No, I do too. I've been working on it for a while. Sorry, we're trying. We're working on it. We have we have some some things coming that I hope will u We'll make things coming.

Speaker 2

Let me make you have here, all right, things?

Speaker 3

Yeah, okay, we we do have some things coming that I hope will make that easier and better for you.

Speaker 2

All right. So there's a studio code.

Speaker 3

Yeah, visual studio code. I love visual studio code for I don't know. I open it every time I want to do it. Get marriage personally, it's just easy. But I I like the copied experience a lot in there. We have we also have different things that we're dog fooding at Microsoft, different models and things that show up. One might show up in VS code first, one might

show up in Visual Studio first. And one of the great things for Visual Studio Code is that it's just it's just it's just faster to release and get things an experiment and prototype. And so when we did our build demo actually this year, what the stuff that didn't ship in the released Visual Studio that we wanted to show that was kind of like you know, kind of hot bits you know that I built on the side.

Was it was very easy to light up Visual Studio Code with that and start playing around with it and show those features than in Visual Studio Code. It's just great for that kind of rapid prototyping.

Speaker 1

I have an I nine machine and so running Visual Studio is no problem for me. It's very fast and I have lots of RAM. But I know that, you know, if on a less powerful laptop, that might take a while, you know to do stuff that I'm used to on my desktop. So Visual Studio Code works really well on lower power machines.

Speaker 3

Yeah. Yeah, the Visual Studio Code, to be fair, is getting big. Oh you know, it is getting bigger.

Speaker 2

Well it's not getting calm though, No.

Speaker 3

No, no, it's not going to be one would hope single threaded apartment model anything. Yeah, in Visual Studio code, but it's uh, well it's single threaded though you know it's all process all different processes right right, but but it's uh yeah, visual it's it's Visual Studio code was lean when I was working on it, you know, about six six years ago. I was like, oh, this is amazing. And then it's gotten bigger and bigger as a as.

Speaker 2

People make demands on it.

Speaker 3

Right, I also use it for more things, so I've got more extensions in there, I've got more stuff loaded in, and yeah, it bulks up, but it is great.

Speaker 2

You start to wonder if we shouldn't be setting up profiles where it's like, oh I need to work as a Python code that's a configuration, or yeah, here I am editing Jason again. You know, it's so does it have the idea of templates like visual studio does.

Speaker 3

No Visual Studio Code it does, but we we so when we did c sharp def kit, we introduced a like a new project command and thing that basically what that does is it goes through the dot that new command and pulls in all those templates. So it uses what you've got at the command line.

Speaker 2

That's cool, that's cool. Yeah, I don't use it so much.

Speaker 1

I mean, Jeff Fritz is a is a huge code fan, a Visual Studio Code fan, and so when he does his Blazer puzzles, they're usually in Visual Studio Code. When I do them, they're usually in Visual Studios. So but I'm just I'm watching from the aside, you know, I'm I'm watching to see when will Visual Studio Code have all the features that I need from Visual Studio so that I could make the jump because I'd like to.

Speaker 3

Yeah, it's it's a it's a really different model, right right, Yeah, I mean Visual Studio Code doesn't have a lot of visual in it either, right, So he doesn't have the designers and those kinds of things, and they avoid.

Speaker 2

But it's also the difference between an IDE and an editor with extensions. It just seems like a different philosophy. I don't really use the designers anyway.

Speaker 3

Yeah, so Visual Studio Code is getting closer to that IDE model now, right, some of these some of the extensions. C sharp dev gets a great example where you know, I always said that, like you know, an ID is the thing that kind of lays down the whole tool chain for you, so you have everything there ready to go to build your solution. But vis code like some of the extensions they do that and and it's it's becoming more id like in that sense.

Speaker 1

And you have hot reload so you can you know, work on it and look at it in another window and you know, h So, yeah, that's about all I use the designers for is just to check, you know, if I'm doing examle or something like that, just to check to make sure it looks right.

Speaker 3

And we're working hard on making that better and better too. So I'm the hot reload great.

Speaker 2

So how much time is your language and how much is tooling when you're working?

Speaker 3

When I'm working most of it when I'm coding, most of it is tooling. I don't. I do very little work on say, like the compilers. I work on the Razor compiler a little bit right now, just because there's there's a lot of low hanging performance fruit in there. But I but mostly I'm working in the tooling space, so doing things in hot reload, doing things and you know and see sharp and mostly in Razor. For like the last couple of years, I've had a lot of

fun work. I swapped over and said, I'll work on Razor for a while. That's been really fun cool. Before that, I did the wind forms designer for dot net Core and so that that was the thing. So I kind of try and bounce around a little bit and sometimes I want to go really deep on something. And it's been Razor for a little bit.

Speaker 2

Awesome.

Speaker 1

Well, I can't wait till I'm looking forward to those upcoming things that you talked about.

Speaker 3

We see, Yeah, they're not They're in the open. You can go look them up.

Speaker 2

Yeah, I mean there's no secrets anymore, right, Like it's always yeah, Yeah, you're right. Yeah. I think it's kind of nice too. I mean it's it's weird. It's just yeah, it's a different world. We just know. We just talk about this is what we're making. You've seen us debate it on GitHub as we've come up with the ideas. Like, it's all pretty public.

Speaker 1

I don't usually use the preview versions of visual Studio anymore. I'm not sure why. Maybe I'm just afraid of crashes and stuff. When I'm working, kisses me off.

Speaker 3

I use dailies. When I get in, I install a newldivisual job, right, it is, and sometimes you should be glad that I did.

Speaker 2

Sometimes you than me.

Speaker 3

Sometimes F five doesn't work.

Speaker 2

Sometimes and then you're literally like, I'll wait for tomorrow's bills and then we'll see.

Speaker 3

Yeah, well, and I've got multiple visual studios installed, so I'll back down to some previous version.

Speaker 2

Really installs have been great, yeah, kind of and kind of essential.

Speaker 3

I guess, yeah, I.

Speaker 2

Don't know how much we've really talked about what's coming in the language for savings side extension members. But because there's.

Speaker 1

Maybe we should wait until after the break to do that. Okay, all right, this is a good time to take a break. We'll be right back with Dustin Campbell on dot ned rocks. Stay tuned. You know dot net six has officially reached the end of support and now is the time to upgrade. Dot Net eight is well supported on AWS. Learn more at aws dot Amazon dot com, slash dot net. And we're back. It's dot in a Rocks. I'm Carl Franklin.

Speaker 2

Yeah, I'm Richard Kembel.

Speaker 1

Dustin Campbell's here talking and we're shifting gears now into C sharp features. I guess what you're talking is what you were about to talk about.

Speaker 3

We can talk about Sea Shark features new things. I mean, like I said, extension members is obviously the big one. That's the one that, yeah, we've put a lot of energy into.

Speaker 2

When you talk about an epic feature that's been going on for a while like that, what has been going on for.

Speaker 1

Well, you mentioned that they're kind of like extension methods but different. So can you give us an elevator pitch?

Speaker 3

Yeah, So the the elevator pitch is kind of a more of a hey, why didn't you do this already for like extension properties or something like that, Why don't we have these already? And it turns out that extension methods, while very convenient to be able to say, I've got a static method, let me put this on one of the parameters, and all of a sudden, I can turn

it into making it look like an instance method. And the very power of that is that, you know, in tell a sense, now allows me to discover APIs I didn't know we're there. And so the question is why didn't we do this before? Well, because it turns out that methods are uniquely you know, designed to be able

to kind of support this sort of thing. They're the only thing other than a type that allows generic type parameters, which you kind of need, you know, if you want to do something on a list of T, you kind of need a place to put that T. And then they're the only ones that other than say an index or that takes a parameter so that you could put

that this keyword there. Right. So the reason we never did anything else with it wasn't because we didn't want to, is because we kind of got ourselves kind of painted into a design corner very quickly. And so the reason now that we've got this the pitch is that, hey, extension members are a syntax that allows us to basically declare the members as if you were going to in the way that they would look if you were going to call them like essentially like their reduced forms what

we call them. So instead of like the expanded calling it as a static member, I'm going to call it in its reduced form, and we put that inside a syntax that we call an extension block. And the real, you know, magic to the extension block is that's the place where you can hang all the stuff that methods get that no other members do. That's where you can put that first parameter that what we call the receiver parameter for an extension method where that this would have been.

That's where you can put attributes on that parameters, where you can give it a name. That's where all that can go on the extension block. And that's also where you can put generic type parameters that will then apply to any member inside of that extension block. And so now all the other members get to inherit all this stuff and now they can become extensions.

Speaker 1

I missed in two thousand and two when we started dot net Rocks that we wouldn't read code on the show. Yeah, However, I'm dying to hear a good example of an extension member so I can grock it better. I mean, I really want to see it, But can you get me an example.

Speaker 3

I think a good example would be like if you wanted to put a property on something that was like I don't want to say count because counts the one that you really probably shouldn't do, and ie innumerable, Right, that's a method today, but that's the one that like it actually just enumerates the whole thing. It's you know, Oh, then to call this thing that you would expect on a collection to be a property, right, but we could add and is empty right as a property, you wouldn't

want that to have the method syntax. You'd want that to be a property to kind of indicate that, yeah, that's that's that's that's a quicker syntax, right, that's a quicker thing to call. So that's the kind of thing that like, it's not there today, but you want to add it. That's the sort of thing that you might add things. And then the other piece that this gives us, Carl, is it gives you the ability to have extension members that are static. So you could have an extension method

is a static on another type. So I, for example, I love the string dot create method. I use it all the time in dot Net, but it's not available on dot Net framework. But it was absolutely able to write it with an extension member for dot Net framework. I could write a create method that was static for the type string. And so now I have a great method that works across framework and then also use the correct one on dot Net.

Speaker 2

Wow, all right when I'm.

Speaker 3

Doing multi targeting scenarios and things, so's it helps. There's a lot of discoverability. So if you want to have a different kind of member and get that same discoverability. That's what you get out of US.

Speaker 1

So extension methods you get to sort of well I wouldn't say override, but you basically get to add things onto a static type. And these you can add static properties to a type that work on that type.

Speaker 2

Yeah, or or non static.

Speaker 3

Or properties that were are instant, yeah, like instance kind of looking exstance type. And so in this release you'll get statics and methods. You'll get instance methods. You'll get obviously instance methods because they were already there, but in the new syntax you'll be able to do methods as well. You'll get static properties and instance properties, and then other things are kind of coming. I think we've merged in

one that's really exciting, which is extension operators. Which that's yeah, so you can have an operator that you didn't write on the on a type specifically, but you said no, we want to have this here, and we want to be able to by bringing in say a name space or bringing in that context. Say, now these operators are

in scope and interesting. We've done that for like the tensor team wants to use that, and some others so we've brought we brought that one in and eventually we'll get to things like constructors stuff like that.

Speaker 1

So I have a little hack that I do. You know, the iclonable interface has been around forever and it's it's an interface a way forever. Yeah, that you implement a clone method and that returns a copy of your data basically a copy of your object, but a deep copy. But it's up to you to create that and return it. So what I do is if I want to make a clone of a deep object now, instead of implementing iclonal, because I might not have eye clonable, right, I just

serialize it and de serialize it. Yeah, Jason serializer. And that's how you get a deep copy of something. And that's a nice little hack that might be you could turn into an extension member.

Speaker 2

That's what I'm thinking of.

Speaker 3

Yeah, absolutely, you could do that today though, right, you could make an extension method just put on a like object. Could this is Carl's clone and then and and you know Carl's JSON clone and make that happen.

Speaker 2

I just don't know if it's a good idea.

Speaker 3

Yeah, that's the extension members thing. Other things that are coming that we don't talk about a lot, but that are kind of cool we're doing. The one that I think is is going to be kind of kind of a quiet, sort of like sleeper hit. Possibly, we'll see when people realize it's there is null conditional assignment. And this is one of these things we didn't do for

a long time because we had reasons. We thought, well, this will make it things confusing, and then we just realized after times like now we're kind of already used to all this stuff, so it's probably going to be fine. We were just we were worried then, yeah, ever since, you know, but this is about like, you know, null conditional stuff, as we call it, the Elvis operator, right, the question dot ye right, So using it for invocations and that kind of thing, and using it within your

conditions for like an if statement. But null conditional assignment is like, but why do I have to check if something's null just to be able to sign a property on it? Right? I gotta say if X is not null, then X dot y equals this for example, Well why can't I just say X, question dot y equals this? And that's kind of the that's the pitch. That's something we thought would be confusing. It turns out to look really that. It just looks fine, and it so flows fine,

and that's so. So essentially it puts the null check in for you, so that assignment doesn't happen if X is noll.

Speaker 1

Well, what if you want to assign it to something else? If it's all so for example, a command parameter, sure, adeo net command parameter, Well, you don't want to send the database and null. You want to send it a dB null value.

Speaker 3

Right, absolutely, and you should do that today. Yeah, yeah, yeah, you can do that today. You know, for those kinds of cases, you've you've got those code patterns to write that, right.

Speaker 2

Yeah.

Speaker 3

For for this that simple kind of thing of like why do I always have to do this? Why can't I just do this in a one liner? We're given some of the kind of those kinds of things. They're just kind of small, simple features. Yeah, what else are you interested in? Some of are really really really pretty small. But a lot of time we're just trying to find things that really, I don't know, that kind of alleviate

just a little bit of pain. Sure, help kind of elevate the expressiveness that people feel, so they don't feel like they're bumping into rules all the time, you know, just make it feel a little more I don't know, natural and intuitive. And so sometimes it's just removing, you know, barriers that didn't really need to be there, we determined didn't need to be there in the first place.

Speaker 1

I've learned some things about sea sharp that I didn't know just by letting co pilot do its thing.

Speaker 2

Yeah, you know, and I say, huh, that's that's a really cool way to do that. I didn't know you could.

Speaker 3

And we try to keep Copilot updated with with the latest, latest stuff. Sometimes hard because it's got to be there, but like you know, we pass along, like because the GitHub repo for the sea sharp line languages out there and we are just big nerds with writing out all the notes and everything, and those feed right into it. Yeah, those are those are those are that's great training data.

Speaker 1

So yeah, yeah, so you mentioned you're working on Razor stuff. Ye, and I d Forrasor and I was I was complaining about in visual studio. You know, when you have a Razor file and a code block that I miss little things that I get in a code behind file or a regular c sharp file. And so what are you what are you working on?

Speaker 3

Over on that side, there's a there's been some investment there. We so a while ago there was an attempt, well not an attempt, but to start to getting towards moving the entire Razor editor stack over to kind of a language server model where it lives, you know, as a separate server that Visual Studio talks to, so we could kind of share a code better with vis codes experience and that kind of thing. And I came in to look at it and it was like, hmm, this is uh,

this needs love. It's getting there, but it's it needs some it needs it needs work to get to get over the finished line, to really get there. And what we what we eventually discovered that is that we're kind of Razor was kind of doing too much on its own, because really what Razor is is it's like it's a pass through. Most of the time. It's like, oh, you're in c sharp here, let me pass you through to c sharp's editor. And it goes and it asks c sharps.

You know, the Rosalind language server, Hey, give me intellisen's in this location in the generated code behind file for a razor Or. It does the same thing if you're in HTML. The times that you're in those transition points where you type an at or code, or you're in a directive, a Razor directive, those are few compared to

how often you're just typing in C sharp hedtmail. And so this is so so what we decided to do with it was this instead of making it a sense, So that makes it essentially three language servers right where you've got Razor, and then it's like going off to two different language servers and serializing all the data, passing it back over potentially you know, in vs code over named pipes, you know, and then taking it, munching it up and passing it again, serializing and passing again back

to VS code. It seemed kind of kind of wasteful, and most of the challenges actually with C sharp. C sharp is the one that has the most i would say, kind of sophisticated experience when it comes to, you know, the editor. So we're implementing a model we're calling co hosting, which is essentially because Roslin's there as a language server

as well. In VS code. It actually has one in Visual Studio, though it's not used by default, but there is there's one there where we've changed kind of the Rosen language server to be able to load other languages that kind of piggyback on C Sharp. So and Razor has all this code also to generate that the C shark code behind and the HTML pieces and kind of push those the text of those into other language the

other language servers. But in a co hosting model where we're living in the same process as as Roslin, we can just make the Razor compiler that runs the code generator or runs runs the code generation to build that

code behind. We could just turn into a source generator and so now instead of running code and Razor to compile it and then push that code into C sharp, we let Roslyn use this entire source generator kind of system, and we can pull on and say, oh, just give me the latest, give me the latest that I need here, and then the code is already in Roslin, and we could just ask at this position, hey, what's intellisence, and being in the same process, now we get back instead

of serialized JSON data that we've then decerialized and we don't know anything about it other than the strings we have the rich rosalins. We know what symbol. This came from we know we can do a lot more with it. Wow, And so the idea is that then we're kind of leaning more into the idea that really Razor is kind of about views and about generating really C sharp code with with htmo as opposed to HTML with some c sharp script but kind of you know, saying no, no,

this is c sharp. And we've done the same thing with sample for VS code, so because it's a C sharp based kind of thing where it's got very much C sharp code behind and it's a very much adotinant language. And so for VS code, the intelligence runs inside the rasinal Language Server. We all live in the same process. We call that call that co hosting. That's something we're working on. It is something that's on a feature flag

right now. It's actually can be turned on in VS but we're we're going to be using it for Visual Geo code pretty soon.

Speaker 2

Okay, So yeah, that was my question.

Speaker 1

I heard you talked a lot about Visual Studio code, but I thought I heard that this is also in Visual Studio.

Speaker 2

Yeah.

Speaker 3

Yeah. The language server is used for both the and VUS code. So there is like a.

Speaker 1

And the language server is a process outside of both of the IDEs is that.

Speaker 3

It doesn't have to be It can just be a logical service that's created and running there that you talk to. You know, it doesn't have to go over it just needs to go over a stream. It doesn't have to be a name. I could just be right there in process. And that's how it is ADS today. When we move it to co hosting. However, when it runs inside Roslin's

language server, it does move. Most of it moves out of process because Rosin wrote a lot of Roslin runs out of process in visual Studio and it lives in what we call Visual Studios Service Hub, and it runs as part of that service over there.

Speaker 1

It sounds like you'd be passing less data more efficiently.

Speaker 3

Yeah, and well, but less data between between Razor and c sharp, which is a big ball of nick.

Speaker 4

Yeah.

Speaker 3

So my hope is that improves performance, but it also just makes it easier to get more c sharp in there.

Speaker 2

Right.

Speaker 3

And then the other thing, Carl, that we've been doing is that we've been pulling more on the Razor compiler and trying to make that more Roslin like. It started out kind of being Rosin like, and then it kind of I think part of the problem is that being needing to serve like the needs of like a really like rapidly developing space at web speed essentially, like you know, as every technology comes on, Razor needed to be there, and so there was never time to kind of go

and say, well, let's what should we do. What's the right thing to do? Like, no, just go, just go and get it done. And so there's a lot of that debt go and while you're going go faster. Yeah, and there's a lot of that debt in the compiler. So trying to make it a little more rosin like so that we can then bring in pieces of Roslin to say, you not have a separate saf for example, C sharp tokenizer in Razor as we have in you know, from Roslin. So we brought in an API to bring

in Roslin c sharp tokenizer. So now you know, nobody has to go to the Razor compiler to say just to give you things that you you know, you would hope would be there, like I don't know, binary literals, things like that that would be at the token level that they would have to code specifically into the race or compiler again to get those features from c sharp

that when we add them. So we're trying to do a better job of bringing over more features from you know, modern features, because as soon as you use you know, as soon as they're in C sharp, if they're not in Razor, everybody's confused about what the dacoder ring is for what C sharp features I can use here? Yeah, and where I can use them. So we're trying to trying to smooth that out.

Speaker 1

To code lens would be nice in the Razor code editor.

Speaker 3

Oh yeah, yeah, that is not on the It's something we were working on, but yeah, that would be nice.

Speaker 1

Well, is that because of the Roslin thing? Like, is that like a Roslin feature? Code lens?

Speaker 3

It's it's not a Roslin feature so much as it's it's just an expensive feature. It's it's because you know, you're running you're running final references on everything all the time, and uh, you know, Razor is I would say Razor has some fundamental challenges with how its model, how how it kind of works, like it kind of parses everything on one every keystroke and rebuild everything on every keystroke,

whereas Roslin's much more incremental. And so when you're typing in a method body for example, in Roslin, we're we're not parsing the rest of the file, it's just just the bits that you're changing. And so to keep a line up there with the final references kind of updating it's it's not terrible. It would be much harder for I mean Razor would. It would just be challenging. I would say, so we but as we move the compiler forward, maybe and get maybe get there.

Speaker 1

Well, I'm I'm mostly using code behind files now anyway, So okay, and it's for that reason that you know, I miss all the things that.

Speaker 3

Yeah, now I get it, I totally get it.

Speaker 1

Yeah, well, that that sounds good, Dustin, I can't wait for that. And is that coming in the next version of dot net or or the next version of c sharp or both.

Speaker 3

Well, the tooling things I'm talking about will be coming in like kind of like the next next the next visual studios we get going, yeah.

Speaker 2

Oh, the next visual studio. Wow.

Speaker 3

Great, And then whenever they show up in VS code, probably in vs code maybe sooner, maybe not.

Speaker 2

We're not expecting a new studio fort net ten.

Speaker 3

These are not things I can speak to.

Speaker 1

Well, okay, I think there are new versions of the studio all the time. But they're subversions.

Speaker 3

Yeah, right, that's right, there are, but that's what you're talking about, right, major versions or things like that.

Speaker 2

I'm not sure, Okay, Yeah, it's just there's been no announcement about a Studio twenty twenty five at this point, and normally, like you think back to see to dot net six, like that was very much tied together with twenty nineteen, like they had to have both, Like you couldn't even run the preview if you didn't download the preview bits at twenty nineteen as well. Not that I love that like that, I've felt like those were two close,

closely tied. You know. It kind of made an impossible situation, Like I feel for the Maui team because they were also trying to push Maui out at the same time. It's like, wait, language is changing, dead platform is changing, and you're trying to build a new SDK. Ah gee, I wonder why that's hard.

Speaker 3

Yeah, yeah, it's tough. Coordination is hard for sure.

Speaker 2

Yeah, So it's just quite you know. It's not like Studio doesn't commonantly update anyway, right, it gets its quarterly. It's like there's new features all the time. It's really a question of when do you declare a new version.

Speaker 3

Yeah, And there's been a lot of summer releases on that too. As we've been you know, putting out new co pilot experiments, trying new things. There's been a lot that e any that haven't hit the previu channel that hit the release channel. So there's been a lot of a lot of updates lately. Yeah, in that space, but.

Speaker 2

It's also been a while. Twenty two is the current version, Like, is it really going to be twenty two? Yeah, it's funny. We were talking about that on the dev team. I was trying to I had to remind people. It was like, do you guys remember what the big depths like we called, you know, twenty twenty two, what the big thing was? Gosh, that was a long time ago. It was sixty four bit that was the big thing.

Speaker 3

That was my gosh, that seems like a lifetime ago that we were trying to get everything out of sixty fourth. Yeah. So yeah, it's been a while.

Speaker 2

Yeah, just make it all work.

Speaker 1

But there's been inter releases like I was talking about before that, you know, just not they're not just bug fixes, but you have new features.

Speaker 2

In these interim releases.

Speaker 3

That's right.

Speaker 2

So what's a version actually it is?

Speaker 3

I mean, you know, maybe we'll just get high enough that will be in kind of chrome version numbers where you just don't even know what you're running anymore. Yeah, I don't know. This is version six thousand or something.

Speaker 2

Right, reopen it and it updates, updates every time you close it, right.

Speaker 3

Yeah, yeah, let's see.

Speaker 2

Oh my goodness, I just pulled up the release notes. There have been fourteen releases on twenty twenty two.

Speaker 3

Yeah, fourteen, and that's just the minor releases, right, the dots. Yeah, yeah, this is the dots, and that means and I think every other one of those I can't remember. It's the even ones are long care support. So yeah, it's crazy.

Speaker 2

It just yeah, it speaks to it's getting really hard to understand what version numbers are when you're yeah constantly, right, it's the even numbers. Seventeen point two is LTSC.

Speaker 1

Yeah, how long is the list of is your barn list? Your list of features.

Speaker 3

To implement for the language, for tooling for.

Speaker 1

Yeah yeah, well yeah, for the ide actually for visual studio.

Speaker 3

Gosh, that's never ending. We have so much we want to do. We never have enough fingers to type them all in.

Speaker 2

Yeah.

Speaker 1

So yeah, do you get help from the community. We do, I mean it is open source. Do you get pull requests?

Speaker 3

Roslin gets a fair number of full requests. We even have somebody we roslin we uh in the c sharp language design team. We've been we experimented with this where the kind of that we have a community member on the language design team who's not a Microsoft employee, so we we we work very closely with with with it.

Then there's a handful of community members that are comfortable putting in compiler features and doing the entire tooling stack and all the features all the way up, which is great because that means because if you know, you submit a language feature and it's like, oh, that's cool, but now we've got a lot of work to do.

Speaker 2

Uh.

Speaker 3

And so the guys that will come in and just do it all, it's like thank you, Yes, we want this too, this is a great feature.

Speaker 2

But can they really do it all? Because I think about the cultural adaptations you have to make for stuff.

Speaker 3

Like oh sure, no, those sorts of things are yeah, globalization and all those kinds of things are different. But yeah, but do but just to get the feature working, make sure it works an inteli sense, put a refactoring in or two, you know those kinds of things. That's pretty great.

Speaker 2

Do you get prs from Mark Miller?

Speaker 3

No?

Speaker 2

And would you accept them anyway? Yeah?

Speaker 3

No, absolutely not. I mean, guy, who's going to accept an all emoji all caps PR?

Speaker 2

I mean, really, you gotta look at yourself in the face afterwards, you know, No, I'm sorry. Yeah, yeah, you know, you guys are all friends.

Speaker 3

Don't get you're trying to get me in trouble. I can tell no, no.

Speaker 2

Of course not.

Speaker 3

Yeah.

Speaker 2

Yeah, you worked for Devax back in the day. It was a long time ago. Now, mind you, it.

Speaker 3

Was a long time. So if it, if it, if it, there's you at all when I say this, it's that's fair. I have been at Microsoft for seventeen years.

Speaker 4

Wow.

Speaker 2

Oh man, wow wowow.

Speaker 3

And it seems like it doesn't seem that long ago that, you know, you guys were doing dot net rocks trips and I'd show up for a while ark or something. It's like that was that seems like not that long ago.

Speaker 2

Last tour was twenty thirteen. Man, it's been a long time.

Speaker 3

Yeah, I was already there for five years, so it's it's been. Yeah, it's been a while since I've been at Microsoft, and it's been it's been a lot of fun.

Speaker 2

Yeah, they took our RV away. They said no more tours for you. Ye know, it was batted around. I had a conversation with a team that's like, would you consider another road trip? It's like, you know, I'm fifty eight, right, come on? Yeah, I mean I would do it. I would totally do it, but I just don't. I don't know.

Speaker 3

Would you do it like the Iron Maiden way? Would you have to get like a jet to fly yourselves instead of an RV? You know you can't. I can't sleep in an RV anymore. I'm too old.

Speaker 2

Yeah. Well, we never slept in the We never did sleep in the area.

Speaker 3

Oh yeah, that's true. I guess you stopped in each place.

Speaker 2

We stayed in little hotels. It smelled bad enough as it was. We stayed at.

Speaker 1

Laking To Ends, mostly on the last one. On the first one, we were looking whatever we could find.

Speaker 2

Yeah, there's a couple where we did, like he did, standing for beside the Denny's. Yeah, next to Denny's.

Speaker 1

Yeah, Okay, what's next after you hang up with us?

Speaker 2

What are you? What are you going to go do? You're on vacation, right.

Speaker 3

I'm on vacation. I'm going to go play mini golf with family.

Speaker 2

That's great. There you go, that's a great thing.

Speaker 3

It's yeah, we're kinds great.

Speaker 1

And when you get back, it's just more more razor code work.

Speaker 3

Yeah it is.

Speaker 2

It's it's the grind to November.

Speaker 3

There's a lot to do and I kind of feel like I shouldn't really be on vacation, but it was, it was planned. It's like and it's never a good time to go.

Speaker 2

It's always you need to take vacations.

Speaker 3

Yeah, for your agreed, and I planned it. But yeah, it's there's just always too much and it's hard to be away sometimes.

Speaker 1

I totally get it. I totally get it. And my wife looks at me and when we're on vacation, you're thinking about code, aren't you.

Speaker 2

How do you know that? Well, yeah, because I'll see it in your eyes.

Speaker 3

I don't. I don't. I don't separate code from vacation. I mean that's just what I'm coding. Let's not get crazy now, Yeah, whoa no vacation can be code. That's okay, it's just got to be like an nes emulator or something.

Speaker 1

Ah, all right, well, good, well man, it's been great talking to you again, and keep up the good work. I know we're in good hands with you at the at the wheel. So thanks, thank you. We'll talk to you next time.

Speaker 4

I'm dot net rocks.

Speaker 1

Dot net Rocks is brought to you by Franklin's Net and produced by Pop Studios, a full service audio, video and post production facility located physically in New London, Connecticut, and of course in the cloud online at pwop dot com. Visit our website at d O T N E t R O c k S dot com for RSS feeds, downloads, mobile apps, comments, and access to the full archives going back to show number one, recorded in September two.

Speaker 2

Thousand and two.

Speaker 1

And make sure you check out our sponsors. They keep us in business. Now go write some code.

Speaker 2

See you next time.

Speaker 4

You got JAD Middle Vans

Speaker 3

And

Transcript source: Provided by creator in RSS feed: download file
For the best experience, listen in Metacast app for iOS or Android