Coding Blocks - C# 6 and Roslyn – Pour Some Sugar On Me

Episode Date: May 5, 2014

This week we’re taking pot shots from the peanut gallery! We talk about new features in C# 6. What we like, what we love…and binary literals. We also struggle to define Roslyn and BONUS! poetry re...ading from Michael Outlaw! Points of Interest Build Keynote in 7 minutes – via @patrikdahlen Allen owes the world a […]

Transcript
Discussion (0)
Starting point is 00:00:00 you're listening to coding blocks episode 10 subscribe to us and leave us a review on itunes to hear more using your favorite podcasting app and check us out at codingblocks.net where you can find the show notes and examples and discussion and other stuff send your feedback questions and rants and comments to comments at codingblocks.net and follow us on Twitter at Coding Blocks and on Facebook at facebook.com slash codingblocks. And with that, welcome to Coding Blocks. I'm Alan Underwood. I'm Joe Zach. And I'm Michael Outlaw. Joe, or no, Michael is getting ready to start us off with some news. Yeah, so if you haven't been
Starting point is 00:00:43 paying attention in the.NET world, the Build event was in April. And The Verge put up a great video on the Build keynote speech in seven minutes. So we'll include a link to that. But it was an interesting take on the Build keynote. Did you watch it? What did you think of it? I did. You know, the keynote speeches in general conferences are always a little bit fluffy so um you know
Starting point is 00:01:09 it's it's not really my thing but i did like that i could watch it in seven minutes yeah that that part was nice and i want to mention that we actually got that from i'm not sure how to say the name patrick dollin so thank you patrick yeah it was... The only thing is I wish that they included more developer-friendly stuff in that keynote. Or in that seven-minute video. Yeah. It was very Windows Phone, Windows Desktop OS-centric.
Starting point is 00:01:35 Okay. But I'm glad I didn't spend three hours watching it. Yeah, I give you that. Well, there's that. Wasn't the keynote three hours? That's a long keynote. Unless you were there, then you'd have been happy to sit there.
Starting point is 00:01:44 Man, sometimes the chairs at those conferences, man, it's worse than an airplane. I'm a big dude, man. I'm up in some people's space. That's not comfortable for me. So the next piece of news is I got called out on Twitter, yes, for not having examples of my mixed link love. So I guess I'm going to have to buckle down and put together some homework my friend yeah that's what it sounds like so i need to put together a pie or not a pocket a blog post on uh how to mix the standard notation with lambdas and
Starting point is 00:02:18 all that so and it won't be hard to do i guess i just completely forgot so uh thanks for calling me out there pas Pascal Coder. I will try and get something together for that soon. Don't worry, Pascal. He deserved it. I'm sure. All right. So we also got some more feedback.
Starting point is 00:02:39 I don't even know how you would start with that one. Lee Englestone. Ah. Yeah. You see there's a would start with that one. Lee. Linglestone. Linglestone. Linglestone. Ah. Yeah. You see, there's a lot of E's there. Yeah. There's a whole bunch of E's, and that's what totally threw me off, because I'm like, Lee. Linglestone.
Starting point is 00:02:53 So, how do you say the Int32 max value or the Int64 max value? Yeah. I thought this was really cool, because when you see Int32 and Int64, they don't really seem that far apart. You don't really get the scope of how different and how much bigger 64 is. Well, I know. So even just today, I had a conversation where we were talking about the max value of N32. And I'm just like, yeah, $2 billion something.
Starting point is 00:03:17 I never bothered to go on. But there's a ManchesterDeveloper.com blog entry where it actually wrote it out. And that's actually Lee's blog. So it's 2,147,483,647 is the Int32 max value. Don't confuse that with our Google Plus account. And that's 16 words. Holy moly.
Starting point is 00:03:45 All right. Now, hold on now, because I got to do the N64 one. Hold on. Nine quintillion. Quintillion. What did I say? Oh, yeah, you're right. You're right.
Starting point is 00:03:54 You're right. Let me start over. Nine quintillion. I'm making up my own numbers here. 223 quadrillion 372 trillion 36 billion 854 million 775 thousand 807
Starting point is 00:04:16 that is the amount of money in Bill Gates' account right now int64.max value yeah I tried counting the words but I ran out of fingers and toes so it's quite a bit more it's not double it's a lot so yeah that's a great way to hear the difference between those numbers so thanks Lee yep that was fun
Starting point is 00:04:36 and also we wanted to mention this was kind of a nice one I'm sure everyone's worked with some Linux guys before and we're always hearing about how awesome open source and Linux is. And those things are awesome, don't get me wrong. But it felt a little good. Maybe I'm a little guilty, feeling a little guilty here,
Starting point is 00:04:54 but it felt a little good to see some of the Linux people that I know get kind of smacked down with a heart bleed. Wow, I think you're a little too excited about that. Yeah, I'm coming off on the wrong side of this i know but totally like the whole internet suffers and you're over there like cheering i don't i don't normally get to say ha windows was safe and so this is you know one of those times when i got to kind of wave that flag so yeah heart bleed uh it was it was actually a terrible thing though i really shouldn't be talking about it yeah that was rough and anybody
Starting point is 00:05:24 who doesn't know about it needs to go look it up right now. Especially if you run a website. Yeah, you need to know about this. And it wasn't just Linux. It was just anything that's really using certain versions of OpenSSL, and you could kind of get some secrets from servers, which is really bad, especially since there wasn't really a good way of knowing if someone got your secrets. So there were a lot of search changing hands.
Starting point is 00:05:44 Just a lot of work happened in a couple days there in early april yeah so there was some good that came out of this though well i mean if you got to look for the silver lining um because well not only did the entire internet update their certificates at the same on uh so last week on april 24th uh there was a new initiative started by a bunch of the major players uh called the core infrastructure initiative and the idea being that uh you know all these major companies would contribute money to help support these smaller, underfunded, open-source initiatives so that maybe problems like this can be avoided in the future. So silver lining in there somewhere. Yeah, but also speaking of preventative measures and security, Microsoft put out a really nice threat modeling tool. And if you've ever tried to do any sort of threat modeling without an official threat modeling tool,
Starting point is 00:06:47 you'll know it's kind of hard to find and get the shapes right for... You can't create those stupid arcs. That's right. So Microsoft put out a free tool. It's really awesome. We talked about that a little bit in Episode 4, so make sure you check that out. We'll have a link in the show notes.
Starting point is 00:07:01 It is quite nice. And the sad part is I just finished up some threat modeling literally the week before it came out yeah and then microsoft like taunts me with it like oh yeah remember all those stencils that you had to create by hand yeah here you go buddy and now you put up there asking like why don't you just use the tool right why why do you why i don't understand why you reinvented everything. I also want to mention, we're always hard-biting you guys for reviews, and we actually got a really nice review on Stitcher from Johnny Moniker,
Starting point is 00:07:30 so I wanted to say thank you very much for that, Johnny Moniker. I'm not convinced that's his real name. And also, so while I may not have written an article about how to mix Lambda with the regular query notation and link. I did put together a couple of blog posts.
Starting point is 00:07:49 One was on database schema thoughts for multiple types of products. So really, if you want to go take a look at this, this was me basically just thinking through some database layout for doing potentially like a review, a review type layout or application. And there were some some neat things that I ran into and just thinking through some of the scalability problems and actual UI problems that you face when you start trying to build things that are flexible. So maybe this will be something that would help you out in what you're doing. And maybe you have some suggestions. And if so, love to hear your your comments on it so we'll leave that link in the show notes for you
Starting point is 00:08:27 and uh outlaw also wrote something that he's gonna talk about yeah yeah so i put up on a new uh entry called the reflection of control i was really uh trying to come up with a better name and and that was about as good as i got that That's awesome. But yeah, so the idea was just trying to, in short, you have a brownfield application, you'd like to introduce some loose coupling into your application. And for one reason or another, dependency, bringing in a dependency injection just isn't going to maybe work with your time schedule or whatnot, but you, you still want to use the intent of what that would do for you. And so, uh, you know, I call it reflection of control. Uh, I wanted to call it poor man's
Starting point is 00:09:18 inversion of control, but, uh, that was already taken. And so that's where the of control portion came in. But, yeah, it does use reflection as the mechanism for finding the classes. But it is an exercise in loosely coupled classes, so maybe some listeners will read it and get some feedback on it, maybe have some ideas on how to expand on it, or maybe they'll find some use for it. Yeah, I actually really like the name. I keep thinking it's almost like Metallica is the band name. It's like Reflection of Control.
Starting point is 00:09:56 It just sounds cool. You should buy that domain name. Nothing else matters. So one other article I threw together recently, well, not so recently, was link lazy loading and just talking about how it can be one of those gotchas if you're new to link. So that might help some people out there who struggle with understanding why after they've put in a link command, they don't have any data out. So you can go check that out.
Starting point is 00:10:22 Also, we'll have that in the show notes and i do want to mention as well that joe also has started writing about 20 different uh blog posts i think he'll finish them up at some point oh no i don't finish them i thought i thought i read the drafts and you guys finish okay so i might actually go in and like tweak a few of them so that he'll have like i mean like he'll literally triple the content on our site as soon as they get published i think that might be what happened with uh alan's lambda and link uh article absolutely that's just hanging out there in the ether somewhere you know i would be surprised if i'm totally making that up pascal coder you were totally right to call him out on that i was pretty
Starting point is 00:10:59 good there all right so uh getting on to the topic of the show today we're basically going to be going over this thing called rosalind that you may have heard about and some of the features coming out in c sharp six so uh i'm gonna let joe because i'm pretty certain he put this title in here he can introduce it that's funny because this is totally a title that michael would do and i'm sure he would have i hadn't beaten him to it but yeah the title we've got here in the show notes is pour some sugar on me and for all you people from back in the 80s you know exactly what that so are you trying to insinuate that i'm back from the 80s well you um you know what like what the yeah that's kind of that's kind of one of your things. What the actual what?
Starting point is 00:11:45 See, I'm the one who's actually putting the pour some sugar on me and referencing Metallica. And Alan here was singing Cherry Pie before the show. So I don't know, man. You're kind of losing some ground there. Dude, I'm on Miley Cyrus and Justin Bieber. What are you talking about? Yeah, Outlaw's actually over there twerking during the show. It's fairly disturbing.
Starting point is 00:12:03 Outlaw did give us the history of Cherry Pie, though. He he did we'll have to have a link to that in the show notes um so yeah I with that I guess we'll just get started on some of the features coming up and we'll do our best to tell you whether or not they're actually done and you can download the source code and check them out or whether they're planned. But yeah, now this is going to be a completely, we're going to discuss every single feature period of the ever. Yeah. Why not? I mean, we may not go deep into them because some of them were actually joking.
Starting point is 00:12:34 We're not. We're not. And there's like 20 or something too. So you probably have to excuse us a little bit as we kind of tab around to figure out which ones. There's more than 20. And because, well, I don't know. The numbers are messed up and nobody fixed them. Yeah. Actually, it's kind of tab around to figure out which ones fixed the names a little. Well, I don't know. The numbers are messed up
Starting point is 00:12:45 and nobody fixed them. Actually, that's kind of shocking. There's definitely more than 20. That's the point I was trying to make, though, is that there's a whole bunch of features we're not going to be able to get to all of them. So we basically grabbed the ones that we could find and find examples of, and we're going to talk about them.
Starting point is 00:13:02 It was really difficult to find some like information on what all of these features were like you could find like little one-liners on some of them but to try to find like actual details into it and it was more difficult than i expected it to be yeah we actually had to do some homework it was kind of ridiculous the examples were not clear in some situations so so why don't we start off with one of the new features coming out, primary constructors. Yeah, I actually really like this one. So I don't know what it is about constructors, but maybe it's just I don't know where they belong in the method. If you're trying to be singly responsible, then you've got this weird method that's next to your one method in your class.
Starting point is 00:13:41 And so it just takes up a lot of room. And usually you're doing something simple like taking some variables and setting them to some properties and this prior constructor it basically lets you slap the parentheses and arguments up there next to your class name so the example we've got here is like class point parentheses nx ny and i think that's pretty rad yeah and to add on top of it, one of the really cool things is that Michael and I were discussing earlier is that gives you your primary constructor, but it also sets up your properties
Starting point is 00:14:13 as well inside the constructor so you don't have to write below your class definition, you know, then put all your properties. You can actually have it auto-create those things for you and be ready for the rest of your class. So it kind of does everything in this one method call. It's pretty interesting. Yeah, it really cleans up a lot of boilerplate.
Starting point is 00:14:32 Yeah, it does. And it definitely creates those variables. It wouldn't do you a lot of good to just have the signature of the constructor there without actually doing anything for you. I thought that it didn't create the properties unless you declared an access modifier on them. Yes, that's correct. So in your point int x, int y example, you're not declaring the property for it.
Starting point is 00:14:57 You're just defining... Those are your constructor parameters, yeah. These are some member variables that are going to get sent. No, they're parameters. They're what Alan said. They are the parameters coming into the constructor parameters yeah these are some member variables that are going to get said well no their parameter they're what he's we're what alan said they are the parameters coming into the constructor that you could then use in the class right to say that this property capital x equals this lowercase x that was in my you know my class line so if i have class class point int lower x comma int lower y. And in my property, I have, you know, int upper x. I can say it equals that lower x.
Starting point is 00:15:30 But that upper, but there's not automatically a property being created for it. Unless in the class declaration line, I added a access modifier to it, and then it would. That's always the best thing. So if you add, like, the public keyword on there, then you get what I was talking about where it adds in it, and then it would. That's always the best thing. So if you add the public keyword on there, then you get what I was talking about where it adds in as member variables. So my take on this, though, is it seems like for a small class, this is going to be some nice little extra sugar, right?
Starting point is 00:16:01 But I could see this getting out of hand where, you know, if you have a half dozen dozen different properties, then this just get gross. If you're defining all of that in line, it just seems like it would be a bad form from a coding standards point of view if you were to do too much with it. Not to mention if you were inheriting a class and then implementing several interfaces. I can just see now that class line getting out of control oh that's so many different reasons to change though maybe at that point that class is doing a little too much well okay i won't argue with you that i won't argue that but but my point though is like it and that's why i said for small classes i didn't realize you're talking about reality. Sorry. Sorry.
Starting point is 00:16:46 I probably should have prefaced that. The one thing that I'm not real clear on with this, though, is the primary constructor. What about classes that have multiple constructors? So this is the only thing that bothers me about it is if you have the primary constructor, which is what we're talking about here, and you have the couple parameters coming in, you can define your properties in there. Well, what if you have other constructors for the class that have different inputs do you be a different signature there different signature but is how are the properties getting set up they're not that's that's what i'm saying that's why you'd have that other that other signature handling it
Starting point is 00:17:18 so but that's that's my whole point if you call this other constructor would you still have to have all your public string first name this is where i see this getting out of control someone will go oh well you know what i should add this in to this primary constructor let me add in you know int z now so that i can also call that one and oh crap i need an int a and a b c d and then some of your variables are cleared here and some are other places it just just gets kind of weird. So it's definitely something that's nice for light classes, but once you start getting heavy, the benefit starts to fall away. I definitely see it light class being nice sugar there. Yeah. Who wants to do the read-only auto properties?
Starting point is 00:17:59 I think we all do. We're all super excited about this. I think Michael's the king of read-only yeah i mean this this is just like you know the read-only auto properties this is just adding on isn't it to to the primary constructors because we already had the ability to do read-only properties right but but now this ability to assign it uh from the primary constructor Or am I thinking of this wrong? No, I think that's right because you can basically say that it only has a get on it
Starting point is 00:18:29 inside your primary, right? If I remember right when we were looking through this. Well, that's what the read-only portion would be is if you only provided a get to it. But this is where you're assigning a value to it on that same line. So you're able to say like a get colon
Starting point is 00:18:46 and then outside of your brackets say equals. That's the initializers. That's a little bit different, right? No, not from the reading that I saw. It seemed like it was an add-on to the primary constructor usage. So in the primary constructor usage that we just talked about, right, we said something along the lines of class point and in parentheses int x, int y. And then on your,
Starting point is 00:19:14 where you define that member variable or the property, you would have like int x and then in curly braces, get colon and then equals your lowercase x from your class line. That's the read-only auto property that's being set there, but it's the auto property because you're not defining a member variable for that property, but it's read-only because you're only providing a get,
Starting point is 00:19:42 but at the same time you're initializing it all at the same time, and it seems like it's very related to the primary constructor feature. Well, it actually sounds more like the next one that we were going to talk about, which is the property initializers, the auto property initializers. It sounds like it's the same thing except you're just setting the get. Oh, you know what? No, I'm thinking of this totally wrong. The whole idea, though, is that because you don't have the member variable for it,
Starting point is 00:20:09 how do you initialize that value for it? Yes. And this is how you could do that. Right. And Damien G. is actually got on DamienG.com. I assume that's his name. He's got a really nice post on probable C-sharp. I thought it was Damien Engine.
Starting point is 00:20:22 I like that, too. And we'll have a link to this in the show notes. We're actually going to mention it a little bit later on. But he's actually got a really nice illustration of what this used to look like. And in his example, he's got a private read-only integer X, like a member variable, so that private. And then he's got a getter with a capital X that just returns that variable. And now we've taken those two lines with maybe nine words, and we've condensed it down to five words, one line.
Starting point is 00:20:49 Cool. And it's nice if you're doing a lot of immutable type stuff. And he's got a really nice blog post. As we mentioned, it was really hard to find information, and there's still a lot of kind of head scratching going on around the Internet trying to figure out exactly what is meant by some of these features. Yeah, so again, that takes us into the the next one which was the auto property initializer which is similar to the read-only except now you have a get set so you can do both of them but what's beautiful is is in the past if you had something like public int x you'd have get set
Starting point is 00:21:20 in your in your curly braces and then on the next, maybe you'd have, you know, X equal, you know, 10. Well, now you can do it all on the same line. You can say public int X get set equal 10. Well, this one makes even less sense because now that I was talking through the other one, it kind of makes more sense because the whole point of the read-only auto property there, the value of it is that you weren't providing the set method. Right. But yet at the same time, you wanted it to be an auto property that you could initialize
Starting point is 00:21:48 to some value, but because you want it to be an auto property, you're not assigning, you're not using some local member variable to be what you're returning. But in this example, though, where they were talking about the auto property initializers where they provided a set, a get and a set, it makes less sense to me. Why? What's the big deal? You can do it all on the same line. You don't have to do it on two separate lines. That's the only advantage.
Starting point is 00:22:16 I mean, it's less typing, right? It seems like very little less. It doesn't really seem like there's a... So the way I kind of think of it is it's really nice for defaulting something. If you want to default something to 10, then it's kind of gross that you declare the variable up here and then 30 lines below, it's defaulted to something.
Starting point is 00:22:34 But if you just have it on the one line, if you're scrolling through the code, you can see, oh, here's what's declared and here's its default value. Yeah, I totally get that. But I guess I was saying that the read-only version makes a whole lot more sense like the actual benefit there i like them both oh i'm not saying i won't use it yeah yeah i'm saying i don't like it i like i like typing less it's not at the top
Starting point is 00:22:59 of my wish list but i'll take it right yeah no i agree so uh the next one that we have on the list is a static type using statements yeah and so the example they give here which is really nice is um they now say using system.math and then call methods like cosine absolute value square root throughout your code without doing the math.square root math.codesign math.abs so that's really nice sort of but i i don't like the the thought of having these kind of classes that look like or sorry these methods that look like they're part of my class when they're really part of this other static class that's kind of hiding up there in the usings yeah it i guess if you had a class that's doing like a lot of console right lining um then
Starting point is 00:23:42 you should probably be using log for net or something. But it's kind of nice that you can trim that console dot off of all of your code. Although, really what you would do there, or what I would do there, is instead of writing console. rightline in 100 lines and throw out my code, I would make one function called rightline and just have it
Starting point is 00:24:01 abstract that away. But now you don't need to. You can just say using system.console yep and then you're good there's interesting so you're actually saying it's you're not importing the namespace you're actually importing the static class all right and then uh this is importing all the static methods into the current namespace yes so it doesn't have to be a static class necessarily? So that's where the math.squareRoot, math.round, all that comes into play. Okay.
Starting point is 00:24:30 So yeah, math may not be a static class, but those are static methods. I'll have to dot-peak that to see. All right. The next thing we had on the list was property expressions. Yeah, and we actually, it's kind of funny, we talked about this a little bit in the link episode, how there's something similar you can do
Starting point is 00:24:50 is with variables inside of a method scope. You can say var x arrow sign 1 plus 2, and that'll set up a function that adds 1 plus 2 whenever you invoke that x. But now we're saying you can do this outside of the method soap so you can have these really lightweight um simple looking functions it actually looks a lot like a functional program like f sharp type stuff or are like list where you can define these and we're actually talking about properties sorry i got a little ahead of
Starting point is 00:25:18 ourselves you can define these properties as expressions with very little syntax. So it looks something like, you know, I'm going to have a property named tomorrow, arrow sign, datetime.now.dateadd1day. Yeah, so we talked about this too, because like one of the things that I said that I missed before were the macros from the C and C++ days. And this reminds me a lot of being able to bring that type of feature back. Yeah, it's definitely missing braces.
Starting point is 00:25:53 And I like braces, so it's a little hard for me. But if it trims lines of code out, then I'll think about it. Well, I guess that would depend on uh complicated you needed your expression to be there right well if we once we get to a semicolon operator you can get pretty complicated yeah we'll talk about that in a sec yeah so so then we have method expressions which is essentially the same type thing except now you're defining a method using Lambda expression. Yep, so we had real lightweight properties. Now we've got lightweight methods.
Starting point is 00:26:32 So you can give that same tomorrow example, except now we say maybe get tomorrow parentheses, and then the rest is the same. Yep, pretty straightforward. Yeah, I mean, both of these to me are in the same camp as far as I'm concerned. They're both macros. Yeah, and so that's five. And I think every one of these was actually a done item.
Starting point is 00:26:55 So these are things that in the actual Roslyn guide as of today, April 30th, these are actually marked as done. And the next one up is something that's planned, but I really hope they do because I really like this one. And that is params for enumerables. So right now, if you have a function that takes any number of arguments, say, like, for example, string.format or console.writeline, something like that, where you take in what is right now an array of objects
Starting point is 00:27:24 and you can do or actually array of any type and you can do um you know list type operations on them now you can actually take in a new strongly typed innumerable innumerable of something and do the same type stuff which is good for me what i was doing with that um those params before was basically converting to a list and doing whatever i wanted before and now i can just kind of take it in as an enumerable and go. Man, so your code is going to get a lot more simple then. Yep. You won't have to convert your enumerables to a list
Starting point is 00:27:55 and your list to an enumerable and then back and forth and back and forth. Yeah, I don't know what I'm going to do with all this spare time. Oh, the monadic nulloll checking this is my favorite i can't even say that one yeah known as the safe navigation operator it's elsewhere yeah how do they rename that somehow and make it worse yeah make it impossible to say navigation and attic something nobody's going to be able to say that. Monatic, null checking. It's going to get truncated down to the Mono operator or something.
Starting point is 00:28:30 I bet if you took a vote, this would probably be one of the favorite features coming up. Definitely. Period. I mean, I know it is for me. Yeah, we talked about in the link episode how null checks can really uglify your link expressions. And now we can work around that a little bit.
Starting point is 00:28:45 And it also reminds me a little bit of the coalesce operation from SQL. If you're familiar with that, you can basically say, if this is null, give me the next one. And in this case, you're actually saying, only get this property if the parent is not null. So you can kind of string along these things until you get the value. And if any of those values along the line uh don't exist or null then you're going to get no back if it does exist you'll get that final value on the far most no more first or defaults i can just first everything well what
Starting point is 00:29:17 this replaces really when you look at it is the whole if parent is not null then this if child is not null then this if grandchild is not null, then this. If grandchild is not null, then this. So this makes that thing just like one line of code. It's just so freaking easy to do. Well, the joke that I was working on, though, was from a link point of view, if you were to call whatever your list is,
Starting point is 00:29:40 or whatever your object is, dot first or default, and then check to see like, okay, is it, is it not? No. Then I can call on my additional, uh,
Starting point is 00:29:52 uh, commands on it. Instead, I'd be able to just do a first and then the safe navigation operator, or however you would say that monadic, no check. Yeah. That,
Starting point is 00:30:04 that, then, and then keep on going. Doesn't first throw an exception though, if there's no item, however you would say that monadic. Moncheck. Yeah, that. And then keep on going. Doesn't first throw an exception, though, if there's no item? Oh, you caught me. You'd have to do first or default. I was wondering to see who was going to catch that. Well, what I like is you can say stuff like, rather than saying, if customer is not equal null, then if customer.order is not equal null,
Starting point is 00:30:22 then if customer.order.payments is not equal null do something now I could just say customer.order.payments do what I actually want to do yeah it's so sweet it makes it so pretty yeah that is really nice we gotta come up with a better name I've heard exclamation points referred to as bangs
Starting point is 00:30:41 you guys ever heard that? oh yeah speaking in pearl or something I don't know what the question mark is but yeah i could say like quiz bang dot quiz bang dot quiz bang nice i'm not actually recommending that by the way yeah no i'm not saying that one i hope that doesn't catch on i hope i didn't just start a fire yeah there's the actually the uh i'm sorry uh that's url yes nobody call it earl if you really want to make alan mad just start calling earls yes we will block you from twitter it reminded me about the uh when when you're saying that about this uh the bang splat the
Starting point is 00:31:20 waka waka bang splat poem i don't know that one yeah yeah we all gotta google this we'll throw it up in the uh in the show notes but it's a waka waka bang splat tick tick hash carrot at back tick dollar dollar dash bang splat tick dollar underscore percent splat waka waka number four ampersand right paren dot dot, dot, slash, vertical bar, curly bracket, tilde, tilde, crash. Okay, so just for those of you out there, I'm going to fill you in on something. Outlaw has been to the ends of the internet. He's seen it all.
Starting point is 00:31:55 This is actually like a really old poem, though. This is not like, you know. Did you ever hear this one, Joe? I just Googled it. I'm pretty sure this predates the internet. Well, maybe not predate the internet. It appeared... Okay, here it is.
Starting point is 00:32:10 It says a 1990 issue of In Focus magazine. So it's pretty old. 1990. Let's think about that. That was back about in the day of Pour Some Sugar on Me, right? Coincidence? Hey, we're going full circle yes so yes there we go all right what's the next one we got constructor type parameter inference yeah let's get excited
Starting point is 00:32:36 let's get excited so this one if if i was understanding it correctly, rather than having to do your brackets, I'm sorry, not brackets, but your alligators to do like a list. And if you're going to do a new list, normally, okay, I don't know, let me back up. You thinking of generics as they exist today, like if you were going to instantiate a new list object, you would say something like new list alligator int, and then maybe you'd have some values, but let's just say you did an empty parentheses semicolon, boom, you're done, right? And now going with the constructor type parameter inference, you wouldn't have to do the alligator int if you were providing the type.
Starting point is 00:33:26 So you could do new list and then in parentheses 1, 2, 3, and it would infer that. Yeah. It would know that you had integers as your type. Yep. And the example they give is actually for the tuple class where before you would have to say var x equals new tuple int, int, int, and then 1, 2, 3 for your values. Now you can just do the 1, 2, 3, and it's going to figure out the int, int, int for you. So it's kind of cool.
Starting point is 00:33:48 It's almost like having var inside of those, an implicit var inside of your instantiations of the generics. Well, specific to the list example that I gave, though, like, okay, so if you were going to have a list instantiated at the time that you knew it up right it'd be new list and then in curly braces one two three in that example right but you could just do just regular parents uh curly braces oh yes just to actually give but you could just skip existing today then list uh type all together and just do new curly brace, one, two, three, curly brace, and it would infer that based off of the type that you were initializing.
Starting point is 00:34:34 So that kind of already existed or the ability, I should say, to... But we're also only just talking about generics here. You can do this with classes as well. Right. So your example is specific to list. That's some syntax that Sugar, that they added a while back. Right. That's what I was trying to clarify. Yeah. So if I had like generic
Starting point is 00:34:54 object bracket, or sorry, class that does something, gators, and then my generic class now can get that inferred rather than having to specify that T up front right so it's it's interesting i mean it might be useful um all right so inline declarations for out params love it oh yeah and that one every time i i read
Starting point is 00:35:20 the description i'm like oh that sounds terrible and then i realized what that actually means and it's those try parses, man. Yes. I can't tell you how many times I've had, because, okay, so I'm probably going to start a holy war here. Because everywhere I can use var, I use var. But then there'll be those times where I don't want to say like int, or I don't want to say like var i equals zero,
Starting point is 00:35:43 and then i equals int try parse, you know, some string, and then, you know, so, or I guess the triparse would have been, you have to do the out instead of the equal because that would have returned back the Boolean. But, you know, the point being is like there are times where, you know, ReSharper will complain to me. It's like, well, you're not even using this value, so you might as well just declare the type rather than use var.
Starting point is 00:36:11 And it's like, but I want to use var. Yeah, I don't want to have five vars and one int. Yeah, actually, in those cases, I'd prefer not to use var. And we've talked about this before with the holy war type stuff. Unless it's clear. Now, if you say var i equals zero, yes. you just say var i that's horrible well you can't do that that's the point so you have to initialize it yeah and and if you were to initialize it and then not use it then you know you're gonna get your hand slapped by resharper or you know maybe you have some other tool that is doing that but yeah so so it's the one place where like i'll have to uh you know declare it and now i won't
Starting point is 00:36:53 have to because now i can just do it in line in my triparse yeah so coming around full circle on what he's talking about is instead of now having those separate lines now you can just say try uh int dot try parse and then some value and then out i and you're done it defines i for you and assigns the value no out var out var i yeah oh but it assigns the value for you and creates you could specifically call it back out as like out int i if you wanted to but specifically in some of the mic documentation they were using VAR it's absolutely beautiful because now you can do it all in one line take that Vlad yes Vlad's not a fan
Starting point is 00:37:34 of VAR that much I actually want us to come back to this when we get to the semicolon thing because I wonder if you could almost because you remember it was split across multiple lines now you'd actually be able to do everything on single line separated by semi colons without having to do that but we'll hit that in a minute so it might even be a decent uh example on that okay so uh the next one this one i actually thought was really cool this one's exception
Starting point is 00:38:01 filters uh so basically when you have try catch statements one of the problems that you have in the past is um all your errors would go into your catch well if you weren't trying to capture or you didn't care about particular types of errors you would have to re-throw and the problem that you have there is that modifies your stack it now knows that you've touched it somewhere in the middle so now what you can have is you can actually have a filter that's tacked on to the end of the uh the catch statement there and you can say hey if it meets this criteria then come into my catch otherwise skip it and what that does is that allows you to not modify the stack if you're not wanting to catch for that type of error so it it's pretty cool. I don't like it. What?
Starting point is 00:38:46 No, I don't like it. Because then my application might throw an exception. I have to have my general purpose catch there so that my application runs bug-free. And you put a comment in that says do nothing, right? Yeah, I mean, it's supposed to, you know, just ignore it. This wasn't an accident. Why would you think that? Ignore it.
Starting point is 00:39:02 Move on. Nothing to see. What this reminds me of is um when you set conditional break points so you set your um your break point and you right click deal a condition that says only break when x equals five something like that so now you can kind of do something similar with your exceptions and not rooting the cost deck is wonderful yeah i love that and and if you're doing web type stuff where you're having to trace through a bunch of pages and controls and whatnot, this really helps you nail down where the error came from without getting a bunch of garbage in the middle.
Starting point is 00:39:33 Yeah, absolutely. All right, so who wants to get really excited now about some... Here we go. I'm going there. Binary literals. All three of you. Boom world yeah there's one guy that's really happy about this somewhere yeah they're probably doing a little bit more low level programming than we are right i've seen i've done a little messing around with binary just kind of no no good reason for doing it like this but it has been kind of a
Starting point is 00:40:02 pain because like it's almost like you create an int and then you somehow convert it to a byte. It's just kind of this gross, hacky way. But now I can just say 0, B, 1, 1, 0, 1, 1, 0, whatever. The only time I've cared about having text values in my code or even if I wanted binary literals in my code would have been for like flags for like uh boring stuff permissions or something yeah if i'm gonna if i want to be able to like or a bunch of values together which you know that's the only really time i can't i can't get excited about
Starting point is 00:40:35 this one i mean it's cool right it's a it's a short end but i mean it kind of does make you wonder though it's like wow why did it take so long yeah but i you know it's because because you never noticed that it was there right and not a lot of people were complaining about it so here we are you know years later yeah and they already had this for hex you know the whole zero x ff whatever thing right so now we're gonna have zero b yeah so yeah it's there and i hate flags by the way what well yeah when you do the flags like on an enum or something or you just have like some sort of byte array and you order together man that was how win 32 api worked man so it's gross so it's it's totally fine if all your flags how are you going to define your
Starting point is 00:41:14 window if you didn't or all the attributes of what the window is supposed to look like as soon as you add one mutually exclusive flag then the whole thing is all screwed up so it's fine if you can have one and two and you know five and those all make sense together but as soon as you start saying oh well i can have seven but not seven and two at the same time because these things it's either you know this feature is on or this feature is off or these things don't make sense to exist together you can do that well um you can't really. Huh? So let's say we've got a flag set and value one is, I don't know, Diet Coke,
Starting point is 00:41:55 and value two is cherry syrup. Well, but they would have been numbers then. Hold on. If we're going to talk about examples, they wouldn't have been string values like that that we were going to ore together. I'm thinking back to my Win32. They're not strings, but they represent things in the real world. Yeah, one's going to be your Diet Coke and two's going to be your cherry syrup. All right.
Starting point is 00:42:15 And it's something like a bordered window with – and then the window has the minimize and maximize attributes. I'm imagining those big Coke machines they have, like, five guys now where you go, and it's like you could do with the code with the Lime. Oh, they're amazing. Oh, they're horrible. Okay, we'll get back to that. But, you know, like if you had to implement something like that with flags and, like, the underlying machine code or whatever,
Starting point is 00:42:43 then you might have had, have had a bit that represents diet and a bit that represents lime and a bit that represents cherry. But the problem is you can have diet and lime or diet and cherry, but you can't have lime and cherry. So now you've got these flags where you have to kind of remember that. I can have this one and this one together, but I can't have this one and this one together. So now you have to have mappings of what can and can't go together in your in your binary stuff it seems like every time i see flags
Starting point is 00:43:09 that always ends up being an issue and then like at some point that whoever you know is actually using that data has to decide well you chose cherry and lime so uh you're getting cherry and i don't like that that's that structure then that rule isn't really enforced anywhere you're gonna make me like try to go go back and write some code on this one because it's been a long time since I've had it. See, this is why I can't get excited about this feature. I've used this feature so little in recent years that I'm having trouble to think back.
Starting point is 00:43:38 And the only code that's even coming to mind is from the 90s. Yeah. I've used it in permission systems before for roles for like read write i mean think about linux code that you wrote uh yeah actually um so but this i mean this is kind of how linux operates with its file permission system right and be clear by you wrote i meant like you were defining the flags yourself yes absolutely saving them in a database and then pulling them back out and doing the ending and all that in the application so yeah i mean but it's one of those things that you do once and you never touch afterwards right so well i guess if you're excited about the binary literals
Starting point is 00:44:16 you're going to love this next one next one's a doozy because let me tell you hold on brother hold on here it comes i'll be back digit separator and if i'm reading this one correctly i actually do like it a little bit because um you know originally i kind of thought that the digit separator meant like if you have the number 1000 rather than 1000 you could say one underscore 000 in place of like the comma for us u.s folks or maybe you or maybe the period if you're Korean and there's all sorts of different separators. And it kind of helps you if you're ever the kind of person who's like counted the number zeros to see if you did 10 seconds or 100 seconds, then this kind of helps you. But it looks like you can actually put this digit separator wherever you want.
Starting point is 00:45:01 So if you've got some sort of number or especially hex that um oh god significance here we go again or you know if it was binary right and you want to break up this big binary number that you did with the 0b and then 16 bytes you could actually separate that into you know groups of four or something logical that makes sense to you and reads easily yeah you can do it decimals too like they pointed out earlier like uh you know instead of having to count places you can do it with decimals too, like they pointed out earlier. Like, you know, instead of having to count places, you can put them where the commas would be. And it doesn't really do anything. The number just makes it more readable.
Starting point is 00:45:31 Yeah, I've got like RGB color. I can say FF, you know, underscore, OO, underscore, OO. Yeah, it's just visually helpful. So, yeah. Yeah, so wait a second. What do you have against those awesome Coke machines? Oh, man. You live in Atlanta. You a Pepsi fan?
Starting point is 00:45:48 Is that what's going on? No. No. Here's the problem is in the old school style machine, you could have at least a couple people that could use the machine at the same time. Now you got one machine. So you got a single queue for it. And it's always somebody who's confused by how to use the
Starting point is 00:46:07 machine that has to sit there for five minutes to figure out how to use it and then once they do figure out how to use it now they're just inundated with choice and they don't know which one to pick when really they're going to get the same coke they've always gotten oh man i just realized i'm that guy oh great i got a complex now i was was at Fuddruckers the other day, and I was like, let me try a mix of the lime and the cherry and the lemon and the vanilla. It's you? And I looked behind me like, oh, my gosh, there's like three people back here. So you're like the seven-year-old again.
Starting point is 00:46:36 And I'm like, there's only seven left. Whatever. Well, this is awkward. No, I will say, though, I'm a fan of the machine from the sheer availability of different products. I do not like the fact that I have to touch a machine that other people are touching when I'm eating food. That drives me crazy because there's this nasty touch screen. Now who has OCD? No, come on, man.
Starting point is 00:46:58 You know people don't wash their hands when they walk out of certain laboratories. Kids touch it. That's all you need to know, man. And, I mean, there's, like certain... Kids touch it. That's all you need to do. Yeah, and I mean, there's like fingerprints all over it, and you know you're having to touch the same exact spot everybody else did because they had to push that button right there in the middle. I'm not a fan. But it is 144 choices.
Starting point is 00:47:16 And by the way, that actually makes me mad when somehow it defaults to like a grape or a cherry or something. I just want a Sprite. And all of a sudden it comes out green or red, and I mad the person bought before you got like you know some grape soup something weird you know i got some grape in your sprite yeah that's frustrating yeah i was gonna push that push button first just let like a little bit of it go before you put it in your cup because i mean but it gives you more opportunities to touch the same button that other people were touching yes after they got out of the bathroom next time i'm just gonna lick my finger before No. But it gives you more opportunities to touch the same button that other people were touching
Starting point is 00:47:45 after they got out of the bathroom. Next time, I'm just going to lick my finger before I go up there and stick around and scream. Oh, Jesus. You're in line behind me then. All right. So, yes. Movie time.
Starting point is 00:47:55 Just wait for me to get back from the bathroom before you get your drink. If you're not familiar with what we're talking about, it's coming to a fast food restaurant near you. Yeah. I think Burger Kings have them too. So, yes. all fine dining restaurants so where are we at now what have we got so we did the digit separator number 13 ish so so 13 ish we are on i think there's 14 now right hold on no don't don't two don't start it would be like it'd be like 11 or 10 all right the indexed members and element initializers and accessors hate it
Starting point is 00:48:35 well i like it hey where's this dollar sign symbol come from okay okay so all right so now it's just starting to look like pro like the deal is that you can do this dollar sign instead of square brackets in the quotes and so you save a couple characters but at what cost this is so that the pearl developers will feel more comfortable in c sharp i need to try to bring in the jquery guys i think that's what's going on oh you think it's jquery yeah it's closer to jquery i think i I don't know. It's all right. I mean, it's a shorthand for being able to create objects that resemble JSON type stuff. So it's a quick way of basically nesting objects from what I can tell. Well, I mean, like one of the examples that I saw
Starting point is 00:49:19 was specifically, you know, imagine you have an array. So you have some array and you have the, normally to access that you would use your brackets, right? And then you'd put your indexer in it, right? And they were saying that with this new feature, you'd be able to do J dot dollar and then that variable. Right? That seems very Perl-like to me. Can you nest them so you get multiple dollar signs in one line?
Starting point is 00:49:53 I think so. Hate it. So if it was a two-dimensional array, you'd have myarray.$x.y? I don't know that that's the the two-dimensional i don't let's hope it doesn't go there i don't think with the arrays you had to use the dollar signs it was only with objects i think with the arrays you could actually do the example that i saw was specifically on an array if i remember right i could have sworn but i mean i think what is about the dollar sign is it's not semantic it doesn't mean anything like you know i see the safe navigation operator the question mark that kind of you know it lends itself to its purpose right so you see that
Starting point is 00:50:33 question mark that means hey this could be null we've got the same thing with the nullable types but the dollar sign money yeah i saw like are we talking about dollars are we talking about finding elements on the page? What's going on? Talking about buying some new Coke machines for these restaurants right here. Yeah, only if you're doing strings do you have to do that. So if you're doing something like a dictionary where you have an int and a string, you can actually do the curly braces and put the ints in brackets and then the string second. It's with strings where you have to put the dollar sign in front.
Starting point is 00:51:08 So if you're doing object properties, so if this was a property of an object, you have to have the dollar sign and then the variable name equal the string. Yeah. Someone's got to see it. Well, no, because even in the... Are you sure it was limited to strings? Because in the Microsoft documentation,
Starting point is 00:51:24 they use dollar for... They show dollar x equals three. So the key. Yeah, the key. Oh, but the key, the key, the key. Yes, the key is what we're talking about. So if you're doing an array that actually has numbers, you don't have to do the dollar sign. Maybe I was just old school, man, but what's wrong with XML? I don't know. I'm not a fan of XML oh come on man they got XSD's
Starting point is 00:51:48 it's like strongly typed yeah it's also extremely verbose when sometimes you don't need that you do the adjacent parsing though you just gotta kinda hope it works you're like I don't know if this is gonna work it worked on the one message I tried that's why the dynamic variables in Newtonsoft
Starting point is 00:52:04 if Newtonsoft says it's so then it's so there it is done i'd rather that than xml unless i'm unless i'm dealing with third parties that need you know strong xsds and that kind of stuff so i don't know whatever yeah if i'm dealing with the third party i'd much rather they have x API. Yes, agreed. You can validate it. But if I'm doing my own app and it's using Web API or something like that, I'd much rather use JSON. It's easier from a UI standpoint, from JavaScript and all that kind of stuff. Oh, it's human readable too, which is nice.
Starting point is 00:52:38 If you're like a big XML document, you just scroll, scroll, scroll. Yeah, it gets old. Or depending on your browser, you're like expand, collapse, expand, scroll, scroll. Yeah, it gets old. Or depending on your browser, you're like, expand, collapse, expand, collapse. Oh. Yeah. So, all right. So, we beat that one to death. The next one is actually kind of cool.
Starting point is 00:52:55 I don't think I'd ever really paid much attention to it, but Await is now available in Catch and Finally blocks. Apparently, people had done, like, massive workarounds for this in the past, and I don't know why I haven't run across this, but it's now there. You can use it. You can close. You can finish threads and close them out. I'm going to use this one where I await on all my binary literals.
Starting point is 00:53:22 There you go. It seems a little weird to me. I always try to keep what's in my catch and finally blocks really light because I really don't want those to fail. You know, it's like something's already kind of failed or finishing up. So it's kind of, to me, it seems like doing something a little risky where I don't like there to be risk. But, you know, hey, that's me.
Starting point is 00:53:41 I'm wrong constantly. I would think finishing up a thread that maybe was out there hung or something, finally would be a good place to do that, right? To clean up the threads. Yeah, but not by doing it by a weight. But this one you're doing... I would rather just kill it. You're awaiting on something.
Starting point is 00:53:56 So you're making a new call on this one, right? Not from the docs I saw. Did I misinterpret it? Was it saying that it was going to return from the await inside your catcher phone? Like the example given in the doc that's up on the Roslyn site. So like in the catch, they have await resource.log async. And then in the finally. Yeah, that's my point.
Starting point is 00:54:21 They're doing a new. This is going to Joe's point about it being risky because they're doing a new this is going to joe's point about it being risky because they're doing that uh asynchronous call and they're going to wait for it inside of the catch which you're already in a bad state yes because you're in your cat but i think what they're trying to do is kind of risky they're trying to see what's happening on that thread at that point and then in the finally they do um await uh res.closeAsync. So they're closing it out. So they caught the problem.
Starting point is 00:54:48 Then finally they're going to close it. So I don't know. I mean, again, I don't guess I've ever run into this issue. But, yeah. Maybe you have. If you've got a good example of this, we'd love to hear it. This is definitely one that we have struggled with a bit. Yeah.
Starting point is 00:55:07 All right. Who's doing this next one? I think Joe. We could not find anything about this one. Because this one is his favorite. Yeah. So I must have spent a good 20 minutes just now looking for it again. But somewhere along the line, we found a new feature called extension add methods.
Starting point is 00:55:22 And we cannot find it again. We have no idea what this actually means it might just be just like the name says as an ad methods there's an extension it couldn't possibly be any more clear yeah no i man we looked at some examples and none of they're about as clear as mud so yeah yeah so we would love to hear anything you've got on this educate us because we have nothing until then we'll wait for like john skeet to write the book yeah john skeet if you're out there we got a question for you yeah and leave us a review so yeah uh anyways um so the next thing uh event initializers this is pretty cool
Starting point is 00:56:07 yep and uh this is for um if you've seen like uh you've basically just um like constructor initializers you're creating new class you do the bracket thing and then you can set the properties right there uh in lieu of a constructor and i can do that with events as well so i'm a big fan of um initializers so this is cool yeah i like anything that with events as well so i'm a big fan of um initializers so this is cool yeah i like anything that makes a line of code shorter i think there's a lot of these though that just aren't i mean they're nice they make your code cleaner that's it uh and i'm not trying to say that you know hey thank you microsoft for putting these features out there i'm don't don't take me wrong don't and don't take them out just because outlaws like poo-pooing on
Starting point is 00:56:48 them exactly but a lot of these are features that i'm not as excited the safe navigation operator so far is the one that i'm the most excited about but these some of these other ones monadic null checking as well sorry i'm sorry yeah this seems the mona mona operator this is not a game changing release yeah this is sugar this is quantity over i don't want to say quality because you know it's really good features but this is a lot of features you know we got around 20 but this there's no links hidden in here and again there was a lot more than 20 yeah there's really i mean most of this stuff is just shortcut ways to do things yeah and that's why i'm saying like you know a lot of these
Starting point is 00:57:25 some of these were like oh i didn't even realize you couldn't do that already you just never even tried yeah you know so a lot some of these ah just can't get excited about it well the binary literal though how about the next the next one's pretty cool though the semicolon operator this one took us a little while to find anything that really made sense to us, but I think Joe actually dug up something on this one. Yeah, it's funny. I'm doing a lot of research on the semicolon operator and trying to find that specific to C Sharp.
Starting point is 00:57:55 Everything you Google for basically directs you to the comma operator, which is common in stuff like JavaScript and Python, and apparently it's the same kind of thing. And what it means is if you've got an M semicolon N, I know that translates really well over the wire, but it means that you would evaluate the first expression for its side effect and the second expression for its value. So an example of that would be kind of the tomorrow thing we mentioned before is now I can say var tomorrow equals parentheses create a new variable var today equals date time dot now and then a semicolon then today date add one day. And what that means is I've got this variable today that's being created in the first part of this line.
Starting point is 00:58:48 And then I'm using that to kind of as a jumping off point for the second part of the line. And it's the second part of the line. And actually it's whatever's on the far most right, because you can chain these things together. That's what gets finally returned to the initial, you know, VAR tomorrow.
Starting point is 00:59:02 So, so this, this one to me, when we were reading through it, it seemed like this was just yet another way to do an anonymous function. Is what it felt like. But what I question about this one, and this is where John and Skeet can help us out,
Starting point is 00:59:18 is that if, like in your example where you did the var today inside of the parentheses, right? What's the scope of that? Is that variable today limited to being scoped inside the parentheses or outside of those parentheses? Can it be used a second time? Or what about inside of those parentheses? Does it have access to variables that are scoped
Starting point is 00:59:44 inside of the method that it's in yeah and we have not been able to find the answer to that question i feel like it's going to be um basically the same scope that the outer variables for because it's parentheses if it was braces i would expect it to be right scope to the brace but i've never seen anything where it's scoped to the parentheses in fact if you think of like a normal for loop and you say var i equals zero, you do have access to that throughout the scope of the following curly braces.
Starting point is 01:00:09 So maybe that's not a good example. But that's exactly my point. Yeah, it's a bit confusing. So one of the, and just so you know, you can't play with this one because this is one of the ones that is planned. So this is all speculation on our part. Like we really don't know um but so tying back
Starting point is 01:00:28 into the one that we were talking about earlier with the out declaration thing uh i can't even remember what that one was called uh oh yeah you're trying to line decorations for params yeah so one thing that you could do here that would be kind of interesting is you could say, for instance, int i equal. And then in the parens, you could say var some number equals zero semicolon int dot parse, you know, whatever value value and then out back to that variable some number right so you could accomplish the same type thing using this is what i was getting at earlier is you could almost basically do that same type try parse thing and out it to the number at the beginning that you defined it but at the beginning of your semicolons. So I don't know.
Starting point is 01:01:29 I think you kind of lost me on that one. I don't know. Yeah, yeah. It seems like you can do a lot more in one line right now. I just have a hard time with the line because it's using a semicolon rather than something else. So it feels like two weird lines kind of smashed or multiple weird lines smashed into one. With the last part being returned. Yeah.
Starting point is 01:01:50 I don't know. That one to me, it seems like kind of an interesting feature, but at the cost of readability. So I'm not too keen on it. Imagine what this would look like inside your for loop. I already have it in my for loop. No, but I'm saying like if you were to use it inside of each portion, the three portions of your for loop.
Starting point is 01:02:10 No. And imagine if inside of there you used, inside of this set of parentheses you had two semicolons so that it looked like an actual for loop. I refuse to imagine that. You could make a for each statement that looked like a for loop. Maybe ReSharper will have a command that I can use to right click and clean that crap up. Yeah.
Starting point is 01:02:35 They'll be like, no, get that out of here. They do for everything else. Yeah, but the scoping question is going to be interesting to see whatever comes of that. Yeah. ReSharper needs a don't do that command. All right, so I think Outlaw researched this next one quite a bit. I did. I did?
Starting point is 01:02:55 Private Protected. That's like awesome. Yeah, it's kind of a conflicting name. It's almost like I'm oxymoron. Private Protected. It hurts my head. Yeah, I'm a little torn so the member is protected inside the assembly but private outside the assembly in english please okay the member is protected inside the assembly but private outside the assembly so okay so let's let's back up so because immediately the
Starting point is 01:03:27 question became like well hold on wait a minute because if the variable is private then it's it's uh you know only accessible inside that class no child class can use it and if you're making it protected then you're going one step beyond and saying okay or are you giving like one extra layer of uh access to it by saying like okay child children can access this now right which makes this sound confusing because now you're combining the two and you're saying like what does that mean right so it's kind of like the protected internal well it was already uh in the language where it was an or right it was uh um let me figure out how that was worded again. It was that for protected internal that already existed, the documentation stated that the type or member
Starting point is 01:04:15 can be accessed by any code in the assembly in which it is declared or from within a drive class, right? So that's what this reminded me of, is that now we're adding on like another or extension here. So we're saying that it's protected inside the assembly or it's private outside the assembly. So I've got a parent class and it's got a protected method that does something.
Starting point is 01:04:39 Now, what we're saying is anything that's inside that assembly can inherit that parent and it can access that protected method. Yes. But if if you're outside and that parent could be a public class you're outside you're in a different assembly and you inherit that parent class you cannot access those protected methods right the private private private protected methods yes right yes that feels like an internal right so that's what i'm saying like it saying. That's where the or portion comes in. That's why I brought up the protected internal because it's already in the language
Starting point is 01:05:11 and it's treated kind of like an or syntax or an or accessor on your member or method. That's the way this one, to me, feels like another or option. It's just a awkward phrasing private protected but i guess if you read it from left to right it's not so bad so you remember to the outsiders it's private insider it's protected i'm still not crazy about the name no yeah i don't i don't really have a good suggestion yeah we're fixing it but uh we
Starting point is 01:05:41 could have made a new accessor method called like outsiders f off yeah yeah i've never had this i'm gonna submit all my suggestions to microsoft i can't think of a time where i would use this but you know if you're i don't know i've never even almost had this come up so yeah it's kind of interesting apparently somebody has so yeah it's weird i guess i would just normally use it as a market as internal and then just not use it by anything else. But, um, not, yeah, except for children. Yeah, that's weird. But then, but then children outside of your assembly, uh,
Starting point is 01:06:17 I just feel like I kind of already trust the stuff in my assembly. Right. So to me, like internal seems like it's, it's pretty well got that, you know, case covered. Yeah, sure. Things that aren't my children can access it. may not make sense not great so this is better but the betterness that i'm buying uh i don't know if it's worth the actually unfortunate name hold up if you're shipping a library or something that you made that other companies bought or something i
Starting point is 01:06:40 can see where this would probably come up you want all your internal stuff that you built yourself to be able to access that information but outside you don't want them to be able to see your internal implementation variables but then i would just make it protected no but then but then the outside of the assembly if they inherited your class they'd still be able to touch it yeah it's just weird though like i want you to be able to inherit my class but i don't want you touching my protected methods. That's weird. Well, no, not necessarily just methods. It might be methods, but it could also be variables, right?
Starting point is 01:07:12 I don't know. I could see that seems to be more the type thing where if you're shipping components to other people. I mean, I'm not saying that I don't see a use for it. The naming's rough. It seems valuable. It's just the naming that I have a problem with because they the two names contradict one another yeah i mean like like okay to illustrate my point further let's say that it was private public
Starting point is 01:07:34 all right and so it's private to the outside world in public to my or you show your privates in public no you know we should probably cut you know if it was if it was private public to illustrate the point right it's it it's really gross and that's what that's the way this feels it doesn't it doesn't doesn't seem like they belong together they don't it's like get your chocolate out of my peanut butter oh man yeah i'm still laughing about the other thing yeah i know i'm trying to i'm trying to keep us centered here sorry about that all right so uh yeah and then the last thing so we beat that one to death too the last one name of operator this one's i this one's okay i mean, Michael doesn't like it too much.
Starting point is 01:08:28 It's like a shortcut reflection method. You have some sort of object, and you want to quickly get basically the name of that object or maybe a method in it. And, you know, say that you got something back from a factory, and you don't really know what the type or any of that is and you want to find out, like, I don't know, quickly where that method came from so that you could log it in case something went wrong. Then you could call name of and then do that instance. So this is referred to as the infoof operator, right? If you say so.
Starting point is 01:09:03 That's what it is. Info of. I didn't make this crap up the foof operator but that's what that that's the way that that's the way uh microsoft says in one of their blogs the the did it have like a little voice button on there that you clicked and it said in foof well the the they they whimsically insist that it be pronounced in foof nice okay um but yeah you know this one seems like the the greatest benefit here is uh your ability to refactor later will accept the change you know easily without you having to go looking through like uh string literals in your code or in your comments. Yeah.
Starting point is 01:09:47 Well, here you go. Pop quiz. How do you actually write out the name of a method to the console? You gotta Google it, right? Now you got a name of. I've never actually done that. I mean,
Starting point is 01:10:04 it's reflection boiled down to its easiest possible way right yeah i think there's uh like some some stack frames coming yeah it's definitely pretty gross well that's if you only get the current method um like the method that you're in which is probably what you're actually doing. Well, I thought that's where you were going with your pop quiz hot shot. Yeah, I deliberately misled you. I don't apologize. Thanks. I just shot the hostage for nothing.
Starting point is 01:10:36 And so with those, those are the however many we've got because they're not numbered properly. We've got links to all these type things uh the the list of them from above we've also got an explanation on some of the more weird ones and then there's also a complete feature explanation and these are all coming from either microsoft or codeplex with the roslyn information. So now, what are we doing? We're talking about Roslyn. Yeah. I mean, how could this show end without talking about Roslyn?
Starting point is 01:11:13 Yeah, and what we're talking about here, all these 20-ish features that we talked about, are all things that come along with the Roslyn compiler that everything is switching over to, the Visual Studio is switching over to. And I heard on a couple of podcasts, I'm not sure which one it was anymore, but we'll have links,
Starting point is 01:11:28 that Microsoft's been using the Roslyn compiler, basically dogfooding it in-house for quite a while. And these are new features that they've been adding in and that we're getting these new features along with Roslyn. And kind of some of the bigger news around there is that the build conference that just happened in 2014 in April, they actually made this project completely open source, which
Starting point is 01:11:52 is very cool. It's under the Apache 2 license, which is really permissive, which is really cool. And I'm really excited to see what kind of stuff happens around like Xamarin and Mono and who knows. Well, now that Xamarin is part of Microsoft. Are they? Wasn't it? Oh, no.
Starting point is 01:12:07 Which one did they just buy? Was it Mono or Xamarin? I thought it was just rumors, but I thought it was associated with Mono somehow. I don't know anymore. Geez. Yeah, but one way or the other, the cool thing is with open sourcing that, what? Whatever, go on.
Starting point is 01:12:28 What do you got? Now go on. Some of the research I was trying to do is Roslyn's been talked about for a long, long time, many years, so I was hoping to find some sort of bullet points and just said, here's what Roslyn is. But I didn't find a real concise statement.
Starting point is 01:12:44 There's a couple things you hear thrown around, like it's a compiler as a service, it's an open source compiler, it allows you to write your own operators, and it allows you to do this, it allows you to do that. But it doesn't really fit well in the definition of the kind of things that I usually think of.
Starting point is 01:13:01 I can't really say that it's just a compiler. It's really built into Visual Studio, and there's a lot of other stuff to it. Well, it was a compiler written in the languages that it actually compiles, right? Yeah, that's cool. Is this Turing complete? Is that the expression where you can build yourself out of yourself?
Starting point is 01:13:17 Yeah, it's kind of cool. So, I mean, the compiler was written in C Sharp, and it can compile C Sharp. And it also, one of the big things that they were talking about was the fact that, uh, it will actually examine the code and, and I forget exactly how they put it now, but essentially you can almost like write your own visual studio type thing
Starting point is 01:13:37 out of this because it has the plugs for doing the formatting and the syntax checking and all that kind of stuff. So, uh, you know, as far as the Xamarin thing going back there, it looks like that was just mostly rumor, but they definitely partnered together at the build,
Starting point is 01:13:51 so there was announcements related to that. But, you know, what I'm really excited about here, though, that I hope to see come out of it, is I'm hoping that this gives C Sharp more of an opportunity to be more cross-platform if if others were to take that in uh that open source compiler and port it to you know other environments yeah linux mac whatever that's what i'd like to see same here because i mean really what are the only cross-platform things we have right now you have java and well but that so yeah so yeah, I mean, yeah,
Starting point is 01:14:29 it is, I get, you still need the runtime. Um, yeah. Yeah. The compiler only takes it down to the, to the managed code part. So yeah, it's gonna be curious to see like, what does this really mean though? But you know, the, the, the hope I have inside is that it would allow for C Sharp to become more widespread and the adoption rate to go up. Because when I look at C Sharp compared to other languages like – Objective-C? Oh, God. Oh, my gosh.
Starting point is 01:14:57 Don't get me started. I was at least going to start with something nicer because Alan mentioned Java. When you look at C Sharp compared to that, to Java and let's not even talk about object to c then you know i mean c sharp is a it's very elegant in the way that you can write uh your your code and i'm not saying that you can't write nice code in java but what i mean is that there's just some features about it that are just so much more elegant about the way that they go about solving the problem and i hope my goal my my hope is that it would become more widespread and i'm hoping that open sourcing roslyn is the the starting point to that happening but we'll see well from the compiler standpoint i mean it like you said that's just compiling the
Starting point is 01:15:42 code that's not running the code i know that's why i the code anywhere. Yeah, I know. That's why I said that. So it's kind of like an empty promise, right? Because when Microsoft first announced.NET way back when, they not open sourced the specification. What would the term be for it? But, I mean, they definitely put out the specification for the CLR so that if others wanted to implement it, then here's the spec for it, and you can for it. But I mean, they definitely put out the specification for the CLR so that if others wanted to implement it, then here's
Starting point is 01:16:08 the spec for it and you can do it. And so far, of all the companies that have taken it, oh wait, no other companies have actually done much with it. So, you know, it hasn't really been widespread in terms of cross-platform
Starting point is 01:16:24 development, which is unfortunate because it is such a nice language to code in. Yeah, I would love to see it spread. It's absolutely my preferred language of choice. It's just you can't use it everywhere. Yeah, it's on Windows. Yeah, and so that's like the open source kind of side of it, but I'm still really just trying to wrap my head around like what exactly, where
Starting point is 01:16:46 Roslyn fits in. Because one of the cooler blog posts I saw was from, I guess I don't want to call the guy smell elegant, but that's the name of the blog. But he actually goes in and adds his own operator overload for
Starting point is 01:17:02 adding two arrays together. And he adds this feature to the compiler, and then you actually see he takes a screenshot of what the code looks like in Visual Studio for his project, and it's got the red squigglies like, you can't do this, this doesn't exist, you can't add two arrays. He goes, he adds it to the compiler, and Visual Studio picks up on the compiler,
Starting point is 01:17:23 and now it's a good thing. It looks right. It works. And that's really cool. You just added something into the actual language, and that's really cool, but especially with the Visual Studio play there, I'm just kind of wrapping my head around where this fits. Yeah, and one thought that I had was that, you know,
Starting point is 01:17:41 I'm sure somebody's going to bring up, you know, going back to my rant from a moment ago, that, oh, well, you know, there's sure somebody's going to bring up, you know, going back to my rant from a moment ago that, oh, well, you know, there's Mono so that could be cross-platform. But I was talking about something that might be more first-class citizen. Mono always seemed like, you know, hey, let's decompile it and figure out how we can
Starting point is 01:17:57 make this work somewhere else. Although decompilers are really good. And I think Microsoft's always been really good about not obfuscating their code. I've never tried to decompile any of their stuff and had a bad time with it. Well, but again, though, my point is that if Microsoft is open sourcing this thing, then it's a first class citizen. It's not, hey, we're reverse engineering what they've done in order to make this work over here.
Starting point is 01:18:23 Right. Here's the code. Do what you want with it. Yeah. Here's's the code. Do what you want with it. Yeah. Here's the original code. Do what you want with it. Right. Yeah.
Starting point is 01:18:31 Yeah, so I'm interested to see it. But it wasn't just Roslyn at the open source either. Alan's got actually a really big list of 24 other open source initiatives. That he'd like to say to you now. Yeah, I'm not going to read all of them. But I will tell you this. It's at www.netfoundation.org and some of the more interesting ones so uh the two people that are two companies that have basically put into this are microsoft and xamarin so xamarin i think they said put six projects into this but they're all
Starting point is 01:19:02 open source so some of the bigger ones that you'll recognize are asp.net mvc you'll be able to get the source code asp.net web api it's another big one um they have some things for hadoop entity framework entity framework is open source the windows phone toolkit which kind of surprised me um xamarin.mobile uh what else signal r if you don't know what that is it's kind of cool it's like a open web socket to a browser so you have real-time communication the azure sdk yeah azure's in there um i mean it and be nice if i spelled it right so i guess we are going to talk about all of these. Not completely. So, I mean, those are some of the bigger ones.
Starting point is 01:19:51 I mean, there's some other that aren't quite as jump out at you, but I don't know. It's kind of cool that they are opening up a lot of these libraries so that if you want to go in there and poke around and figure out how they work and extend them to do other things, you have access to do it now. But, again, and this is where my hope comes in, right, is that this is all great, and I'm glad that to do it now. But again, and this is where my hope comes in, right, is that this is all great and I'm glad that they do it, but what I really would like to see is this thing to become useful
Starting point is 01:20:12 on other platforms too, right, so that the adoption rate really kicks off. So I don't have to use Objective-C. Right. I mean, because the thing is, the whole idea is, well, any open source, right, The whole idea is you get a community involved, and they come up with needs that maybe never would have made it in because Microsoft looked at it and said, hey, we don't have enough demand for this. But now the community can help build this thing up. So I don't know. It would be awesome if these features get added, and then they all of a sudden, instead of just being limited to a Windows environment,
Starting point is 01:20:47 now you see it pop up on Linux or Mac. I mean, that would be excellent. So I don't know. We'll see how this goes. From what I understand, this is brand new. The.NET Foundation is, I mean, it just came about. So I guess we have a little bit of waiting and seeing yep and also i think this opens the door to a lot of stuff i haven't really thought about yet um one thing that springs to
Starting point is 01:21:12 mind is that jet brains um who make the resharper that we always talk about and love very much they actually um posted an article talking about how they're not going to be switching over resharper to roslyn because they've got a lot of time invested in their current compiler but what i hadn't even realized until this point is oh they've got their own kind of c sharp compiler built in that's going out and doing a lot of these things and this is how we get those extra features but it makes me wonder like well what kind of other stuff can you do with a compiler besides you know syntax highlighting and and refactoring type stuff so maybe we'll see a lot of other really cool tools kind of come out of this. I love the ReSharper.
Starting point is 01:21:49 Yeah, the barrier to entry is now lower. So I don't know. We'll see. Yeah, so that's exciting. Yeah, that's about it for Roslyn. So there were a lot of resources, and we mentioned a lot of these, but we just want to kind of gather them up here at the end. We talked about Damienge, or Damien G.
Starting point is 01:22:12 He's got a great blog post on the probable C-sharp features, and they're all actually really illustrated and done up really nicely. Jonski actually has got a really great blog on his first reactions where he kind of gives his in-depth opinions on a few of the features which is really cool and we've got an article from Hanselman
Starting point is 01:22:37 it's really good speaking of Hanselman there was an episode of Hanselman's and.NET Rocks that we'll have links to where they actually interviewed someone from the Roslyn team that kind of talks about what Roslyn is and what things are looking like for the future. With that, why don't we go to the tips of the week. What you got, outlaw? As C-sharp developers are often intertwined with Java developers, should you find yourself using IntelliJ as your IDE of choice for your Java development, which is also another JetBrains product, called ideacolorthemes.org that was mentioned on a Stack Overflow question where you could go in and get themes for your IntelliJ environment
Starting point is 01:23:33 that other people had already put together. So depending on what kind of color scheme you liked, maybe you'll find it there. So you can keep your color scheme because this is among like intellij app code you know i use webstorm too it's really nice pretty sharper yeah i mean there's a studio it wasn't uh you know don't get me wrong it wasn't like the end all be all of of uh list you know of available choices you know i mean there are certainly limitations there but uh you know it
Starting point is 01:24:01 was definitely like a nice starting point if you wanted to poke around because intellij out of the box only comes with like uh i think three um uh you know uh uh themes oh you guys use the dark theme in visual studio don't you oh yeah yeah i'm a fan i i i'm trying to right now i still don't like it it takes a while to adjust but it's so much easier on your eyes oh man it's awesome and and so intellij has one that's called uh like darkula but it's not quite at the same level as as visual studio i'm impressed you said that with a straight face yeah very cool but i did all right so my tip of the week was I was trying to do some debugging, and one of the things that's frustrating is when you're trying to initialize objects, a lot of times it'll just step right over it. You even try to F11 into the different properties, and it just skips over it.
Starting point is 01:25:00 Well, if you go into your options, debugging options, and you dig into some of the uh one of the sub menus and there there is actually a section to where you can tell it to uh not skip the property initializers so then you can actually step through each property that's being set in your object initializer which is really nice because i had some situations come up where uh you know my object was failing i kept ending up in my in my catch and i was getting really irritated because it would say that there was a a cast error well when you got 20 properties it's like oh come on of course it's going to be the 19th one right so um turning that feature on allows you to step through some of it now the the
Starting point is 01:25:46 the odd thing is this didn't work in every situation and i can't explain why that happens but i would say that at least 75 of the time it did work so again that's probably an option worth checking out especially if you have object initializers all over the place so that's mine so is this the uh step over properties and operators that you're referring to? That is it. So to go to that, you would go to your debug menu, options and settings, and then under general, you will find step over properties and operators, and then in parentheses, managed only.
Starting point is 01:26:24 Yep. So when you check that actually check it don't uncheck it it will let you go through each one individually yeah i thought it was it was skipping was that's what that's why it's not very clear it's it's the the check is step over properties and operators so you're saying that you want to because it was default checked on mine um i can't maybe that's a studio 2013 feature that it's default mine's yeah that might be it mine's 2012 there's definitely some default changes oh yeah yeah so i checking means that you actually get to go through each one of them, if I remember right.
Starting point is 01:27:06 It says step over, which seems unclear, and that's why this was sort of muddy. We'll have a little screenshot there in the show notes. And also, I wanted to throw out, I guess it's kind of recommending the competition in a way, but there's two podcasts that I've discovered in the last two months that I finally just caught up on both of them, but they're both really excellent. The first is the Full Stack Podcast, and this is really cool because you've got one guy who works on the service side
Starting point is 01:27:35 and one guy who works on the front end, and they kind of share their perspective from, or they talk about different topics from both of their respective perspectives. So that's really cool. And also the John Morris show, who he ends up talking a lot about. He does these really cool monologues kind of about things in the coding world from kind of like a freelancer position, but it's often the kind of things that are like around coding
Starting point is 01:28:02 that's not hung up in like the semicolons and that sort of thing thing so he's going to talk a lot about like motivation and learning new skills and and that sort of thing and just a really cool podcast so i want to give those guys shout outs so go download uh yeah i'm adding that right now so all right so with that we'll be putting uh the links in the show notes and be sure to subscribe to us on iTunes, Stitcher, and more using your favorite app. And be sure to give us reviews as well. We really appreciate those. Those go a long way to help us out. Thank you, Johnny Moniker.
Starting point is 01:28:34 Oh, and also the actual web or the page for this particular one will be www.coatingblocks.net slash episode 10. So be sure to check that out um and contact us with a question or a topic if you leave your name preferred method of shout out be it website twitter whatever we'll be sure to mention you on the podcast so you get some love there and uh please do leave us a review on itunes if you do that and we see that, you know, you might even get a little bit more love on the show. So, uh, and also on Stitcher. Um,
Starting point is 01:29:08 and, and, send us your feedback, questions, and rants to, uh, email address comments at coding blocks.net. And,
Starting point is 01:29:16 uh, make sure you follow us on Twitter at coding blocks and, uh, tweet us your links and articles and anything cool you find. And we'll share on the show and give you some props so so this uh john morris there's actually two john morris podcasts yeah uh and that's that was actually really there's because i john morris show and then there's the john morris show and it's the john morris show that is specific to coding right and i found
Starting point is 01:29:42 them i think on stitcher initially and then i I went to iTunes and I downloaded the wrong one, and I was very confused. Yeah, because that's going to be an ESPN broadcaster that you'd get from that one. Right. Yeah, very different. So the coding might be talked about a little bit less than the ESPN one.
Starting point is 01:29:58 Right. And I could be wrong, but I think the Fullstack podcast is actually not on Stitcher. So that's unfortunate for me because I have really become addicted to Stitcher. So, well. Is that a JetBrains product? That's it. There are a few products I like that JetBrains doesn't make. Well, I guess that about wraps it up, guys.
Starting point is 01:30:23 We've got about an hour left until i turn into a pumpkin so uh oh oh no wait before we wrap up though our next show is going to be on uh creation patterns yeah so we've got we've got uh so outlaws doing the oh no we're all doing them it's not like i'm on my own but which one own. I'm coming to defense of my boy Singleton because everybody's on him about, oh, you're an anti-pattern. By everyone, you mean me? Yes.
Starting point is 01:30:53 I'm like, oh, you know what? F that. That's my boy Singleton. Don't be messing with him. You know, I just typed in here, Singleton's R in Google. Oh, man. Oh, man.
Starting point is 01:31:02 Evil, bad, pathological liars that's my favorite i read the article actually that was a good one uh and then joe has got uh wow that's awesome it really does say pathological life i wasn't kidding wow yeah i don't know know, man. I kind of like... I don't know. I guess the prototype pattern. No, wait. That's your favorite pattern in the creational series? No, which one are you doing? Well, so originally we talked about doing a pattern each,
Starting point is 01:31:37 but then we kind of switched it up, so it was like just the creational patterns. But now there's too many creational patterns for us. I didn't think... Oh, no, no. We'll spread that across multiple episodes. So the very next one, though.'s an there's too many creational patterns for us i didn't think oh no no we'll spread that across multiple episodes so the very next one though so outlaws doing singleton joe's doing factories no no that's mine i got the factory oh you set me up here all right then we're running i guess i got builder all right fair enough we'll all
Starting point is 01:32:01 talk about it i'm feeling great about it, apparently. So, yeah. Definitely check back with us and subscribe to us because we've got some cool stuff. And the cool thing about this next series of podcasts that we're going to be doing is they're going to be language agnostic. They won't matter, right? I mean, this is the same type of design patterns that you'd see in Java, C Sharp, whatever. It's going to be out there. So, uh, yeah, that's a wrap, but not in objective C.
Starting point is 01:32:32 Apparently nothing good happens. Dave transcended. Uh, all right. Yeah. Thank you.

There aren't comments yet for this episode. Click on any sentence in the transcript to leave a comment.