CppCast - Catch 2 and C++ the Community

Episode Date: December 14, 2016

Rob and Jason are joined by Phil Nash, Developer Advocate at JetBrains, to talk about updates to the Catch Unit test library and new features coming to CLion and ReSharper for C++. Phil starte...d coding back in the early 80s, on 8-bit home computers: from the ZX-81 to the Commodore 64, in BASIC and assembler. He later moved on to PCs and C++ in the early 90s and, despite forays into other languages, keeps coming back to C++. His career has taken him through domains such as anti-virus, mobile, finance and developer tools - among others. He's the original author of the C++ test framework, Catch and is now Developer Advocate at JetBrains for CLion, AppCode and ReSharper C++. His hobbies include writing podcast bios and trolling the podcast hosts. News Minimal, Header only Modern C++ library for colors in your terminal The view from Nov 2016 C++ standard Meeting Issaquah C++ version of ruby's integer::times via user-defined literals Phil Nash @phil_nash Level of Indirection Extra Level of Indirection Links Catch C++::London Munich User Group: Functional C++ for Fun and Profit YouTube: Functional C++ for Fun and Profit JetBrains ReSharper Ultimate 2016.3 is Released JetBrains CLion Discounts JetBrains AppCode Discounts JetBrains ReSharper C++ Discounts CppCon 2016: Nicholas Ormrod "The strange details of std::string at Facebook" Sponsor JetBrains

Transcript
Discussion (0)
Starting point is 00:00:00 This episode of CppCast is sponsored by JetBrains, maker of excellent C++ developer tools including CLion, ReSharper for C++, and AppCode. Start your free evaluation today at jetbrains.com slash cppcast dash cpp. Episode 82 of CppCast with guest Phil Nash recorded December 14th, 2016. In this episode, we discuss colors in your terminal and Ruby in your C++. Then we talk to Phil Nash, developer advocate from JetBrains. Phil talks to us about updates to both the Catch Union the only podcast for C++ developers by C++ developers. I'm your host, Rob Irving, joined by my co-host, Jason Turner. Jason, how are you doing today? Doing good, Rob. How are you doing?
Starting point is 00:01:23 I'm doing pretty good. Looking forward to Star Wars this weekend. A little non-technical topic to start off with. Yeah, we don't have plans to go see that yet, but we probably will at some point. I didn't buy tickets ahead of time. I know last year for Force Awakens I bought tickets a couple weeks in advance and I went with my son, but I'm not sure if this one's going to see
Starting point is 00:01:46 the same kind of rush as the last one did. Well, for what it's worth, and I don't know how much this is worth, but Will Wheaton, do you know who that is? He reviewed it saying it's the best Star Wars movie he's seen since 1977. Oh, wow.
Starting point is 00:02:02 Wow. That's a good review. That means he thinks it's better than empire that's interesting uh yeah wow okay so i'm looking forward to it at the top of every episode i'd like to read a piece of feedback uh this week uh neuro burner writes in saying i've been listening to your show on c++ package management and as a Hunter user, I'd like to take the time to promote Hunter. The major pro for Hunter for me is that it does not need any dependencies aside from CMake 3.0.
Starting point is 00:02:32 Hunter is written as a CMake module. Conan, on the other hand, needs Python to run, and I can't remember Microsoft take on dependency management, but as it's Visual Studio only, it wasn't a contender for me at all. For example, to add boost headers to your project, you only need to add cmake huntergate.cmake to your project and create a cmake list.txt file.
Starting point is 00:02:52 And he included a whole example here, which I'm not going to go through line by line. But he says, I hope you give Hunter a fair chance. If you have any trouble, Ruslo is very active on GitHub. Have you heard of Hunter, Jason? You know, I don't know. But I do know that I haven't given any of these recent package management things a fair shake, and I need to. Even Conan. Yeah, Conan's definitely showing promise, especially with the news we were sharing recently with, what was it, the frog company working with them. I can't remember the name of it now.
Starting point is 00:03:25 Oh, yes. Yeah, that's it. But yeah, Hunter looks like another good option. I'm not sure how long this one's been around. How long has it been since CMake 3.0 came out? If that's the requirement. I don't recall. You don't know?
Starting point is 00:03:39 It's been a while since I've monitored CMake releases because it does everything I need it to do now. Right, right. Well, we'd love to hear your thoughts about the show. You can always reach out to us on Facebook, Twitter, or email us at feedback at cppcast.com, and don't forget to leave us reviews on iTunes.
Starting point is 00:03:56 Joining us today, again, is Phil Nash. Phil started coding back in the early 80s on 8-bit home computers, from the ZX81 to the Commodore 64 in BASIC and Assembler. He later moved on to PCs and C++ in the early 80s on 8-bit home computers, from the ZX81 to the Commodore 64 in BASIC and Assembler. He later moved on to PCs and C++ in the early 90s, and despite forays into other languages, keeps coming back to C++.
Starting point is 00:04:14 His career has taken him through domains such as antivirus, mobile, finance, and developer tools, among others. He's the original author of the C++ test framework Catch, and is now a developer advocate at JetBrains for CLion, AppCode, and ReSharper C++. His hobbies include writing podcast bios and trolling the podcast hosts. Phil, welcome to the show. Hi again. Hi, Rob. Hi, Jason.
Starting point is 00:04:35 You know, how often do you actually get to engage in this hobby of trolling podcast hosts? Well, this is my second time so far far but i'm thinking of moving into it as a new career if you manage to pull that off let us know i could use some you know career advice also i'll let you know yeah it sounds like a good side job uh well you know the format of the show obviously phil um we're going to talk about a couple news items and then we can uh start talking to you about catch and some of the stuff you've been doing with JetBrains recently, okay? Okay. Okay, so this first one is a new minimal header-only modern C++ library for putting colors in your terminal.
Starting point is 00:05:15 And I don't really see a use for this, but it seems like kind of a cool tool. What are your thoughts on this one, Jason? I think you're primarily a Windows user, which is why you don't see any usefulness in this. I thought I had support for Windows too, didn't I? It does, but you Windows people are used to your GUIs and stuff. That's true.
Starting point is 00:05:36 I thought this was interesting because I've got something very similar to it in Catch because I write a colorized output to the console, both on Linux and Windows windows so i've had to solve a lot of the same problems i didn't uh try this out but um just looking through the code i couldn't see the windows support in there so maybe you know something i don't jason uh i thought the major point of this release was that it added windows support but i haven't tried it myself yet yeah i haven't looked at the code but they they have a little GIF running a demo here,
Starting point is 00:06:06 and one of the demos is running command.exe. So that's definitely Windows. Okay, I'll have to look at that again. Yeah. But similarly to you, Phil, I could see using this in ChaiScript to output error messages, which I haven't done yet, colorizing it there.
Starting point is 00:06:20 I could see that being handy. Okay, this next one is a very, very long and detailed trip report from the November C++ Standards meeting in Issaquah from Michael Wong. And he's basically going over the state of C++17 release, some of the feedback they've been getting from the different national bodies, and basically saying it looks like we're on track for C++17 to be officially released before the end of next year. It would be great if C++17 comes out in 2017. It would be. That would be nice. But I just wanted to comment that this trip report goes into way more detail about the actual process than any other one that I've read yet. Yeah. So anyone who's curious about the process, I definitely recommend you read it. Yeah.
Starting point is 00:07:09 The process of, you know, asking for comments, going over that feedback, um, it's, it's going over in a lot of detail and he's also going into kind of some of the specific, uh, comments on different, um, the, the different working groups are're looking at, right? Right. I was very surprised to see that they actually brought back up for a vote adding concepts back in for C++17 and
Starting point is 00:07:36 unified call syntax and dot overload. Yeah, it looked like a bunch of the national bodies were re-requesting some of those features, but apparently there was maybe an equal amount of support for preventing those features from being added to C++17, if I read that correctly. Yeah, it looked like Concepts had the closest vote, 22-4 moving it into C++17 and 24 against. Yeah, that is really close.
Starting point is 00:08:06 That's a shame. Yeah, my main takeaway from this report was that C++17 actually does look like quite a solid release. Quite a big release, in fact. Maybe no individually big features. They've all been pushed back, but there's a lot there. And I'm not sure that we really need that big churn on the language quite so frequently. So if you look at the things that have been pushed back to C++20, if we do get them in C++20, I think that's going to change the language perhaps even more so than C++11 did. Yeah.
Starting point is 00:08:41 Yeah, I guess the concern some people have is, is it going to be too much for C++20? Is it going to wind up getting pushed back even more? I don't know. That's likely to, yeah. Yeah. I expect some of these. I expect concepts. We'll make it in 20. The other ones like unified call syntax, dot overload.
Starting point is 00:08:56 I'll be more surprised if those reach consensus on exactly what they should be. We'll see. I guess the one thing is, what is our coverage going to look like over the next year? Because it sounds like they're just going to be going back and forth with some of these comments, and then it's going to prove it's probably not going to really change much over the next year so we might not have as many new standards features to talk about over the next year until they start ramping up to c++ 20 work yeah probably yeah okay well the next article is um C++ version of Ruby's integer times via user-defined literal. And one quick note on this article, Phil noticed that you couldn't click directly on the link. So when I post the link in the show notes, I'm going to post the link to the homepage blog,
Starting point is 00:09:39 because we found that we had to actually click on that in order to get to this particular post. But this is a pretty interesting article. If you're not familiar with Ruby, the scripting language, one thing you can do is say something like 3.times and then have a block of code. And it would iterate over that block of code three times. And you can also pass in 3.times i. And it would obviously go increment over i. i would go to zero to one to two and you could use that in the block of code so this developer managed to do the same type of behavior with c++ using user-defined
Starting point is 00:10:19 literals yeah so you end up with three underscore times basically yeah and it seems like he just needs to put in this little um you know this little struct and uh and it just kind of works right yeah yeah it's too bad you can't do dot times but uh but i guess this works pretty well i had a quick look at this article as well once I got the link working. I like that it was inspired by Kevin Henney's talk, Declarative Thinking, Declarative Practice, which is a great talk and I highly recommend watching that if you haven't seen it. But I do think it's a little bit of a stretch to say that this technique led from that. But was uh is interesting and fun maybe even useful um i'm just not quite sure it's valuable enough to to use something so un-idiomatic especially since you
Starting point is 00:11:12 can only use it with numeric literals right yeah i mean i'm in two minds about taking it seriously myself i'm kind of curious personally because he does some benchmarking at the end and shows that his version is slightly slower than just a regular for loop and that surprises me i want i'm curious what the code gen is doing differently he does point out afterwards that uh someone suggested he could do this a little bit differently using some metaprogramming and the metaprogram version of this uh executes fast, if not faster, than a for loop. I missed that. This version appears to perform as good, if not sometimes better,
Starting point is 00:11:52 than the raw for loop. I'm not sure how it's performing better, but it's pretty impressive. That may actually play into the declarative programming aspect. When you write more declarative code, you give more scope to the compiler to optimize. So perhaps that's it.
Starting point is 00:12:07 Okay. Well, it's a very interesting concept. I'll put the link to that in the show notes. So Phil, last time we talked to you was before you started working for JetBrains. Do you want to tell us a little bit about what your role is with them? Yeah, my official title is developer advocate.
Starting point is 00:12:25 And you might be more familiar with a term like developer evangelist. And there's some discussion about whether they're actually the same thing or not. I'm not really sure that that matters, because with both terms, different companies will use it slightly differently anyway. So it's really, you know, what do you mean, on a case by basis? But, you know, usually there's some sort of community outreach. It's more about raising awareness than trying to sell anything. I'm definitely not in sales. Still a developer. But what I particularly like about the advocate name is that it actually implies more of a two-way relationship.
Starting point is 00:12:59 So I actually advocate back from the developer community to JetBrains. So they're going to bring up issues that come up within the community and saying, what can we do about this? So I know that evangelists do that as well, but I do know that's definitely the case in this role. So what kind of, I don't know, maybe if you could give us an example, what kind of feedback you've gotten from the community and how you've kind of taken on this role so far? So I'm still quite new at that bit, but certainly in our last release of C-Line, for example,
Starting point is 00:13:35 we made some changes to the way that we use CMake, particularly how we choose which configurations to use. And there was a lot of talk in the community about how that broke certain workflows. That's an example of something that I would actually advocate back. Although in that case, it already bubbled up through the system anyway. Okay. So what's it like been working with the C++ community in this role? Are you attending lots of conferences, user groups? So the funny thing is, before I took this role role i was actually already going to lots of conferences speaking a lot to them uh meet up groups and of course i got my open source projects so i was
Starting point is 00:14:12 already very community focused but that was all on my own time and now that's moved over to my work time um you might think it's sort of all a little bit a little bit less authentic but i haven't found that to be the case uh it's just that now I get paid for doing what I already wanted to do. So it's really great. But I do have some new responsibilities as well. For example, you know, I work on the JetBrains booth at conferences. That seems a bit more like work, but actually most of the time it's just chatting with interesting developers, sometimes about JetBrains products, sometimes not. So, you know, I'm quite liking that as well. So what's then the next conference you will be going to and manning the booth and speaking at?
Starting point is 00:14:51 I would need to check my calendar. Wow, so it is a lot. Yeah, well, it's not till February, actually. There's a conference in Norfolk in England, the Norfolk Developers Conference. I'm actually going there to speak more about Swift, which is another branch of what I'm doing at JetBrains and mobile development. I'm guessing you were at Meeting C++ recently? I was, yes. How'd that go? That was my first big conference where I was there on the JetBrains booth. So I probably spent more time on the booth than I might have done otherwise. So I didn't quite get to see as many talks as I'd like to.
Starting point is 00:15:30 So that was a little bit disappointing. But I definitely spoke to a lot of people and got a lot of new contacts, a lot of interesting feedback, some of it even about JetBrains. Very good. So relating to JetBrains, there any recent uh announcements about some of the tools or updates that we should go over yeah so when i told the team that i was going to be on here and i just asked if you know there's anything we wanted to talk about the first response i got was don't forget to mention how insanely cool we are so there's that but uh slightly more seriously we've uh we've actually just released new versions of c line and app code just in the last few weeks and there should be a new resharper c plus plus
Starting point is 00:16:11 release this week probably tomorrow and they're actually quite big releases with some you know really great stuff uh i'm not going to run through all of that now if you want to find out the details we've got uh what's new blog posts posts and some screencasts that I recorded. But I just want to give you a couple of headline features from each. Sure. So in C-Line, we've made some big strides on C++11 support, and we've also made a start on C++14. And the plan for the next release will be much more of that.
Starting point is 00:16:41 Just to be clear, that's the editor, so not the compiler compiler which is going to be gcc or clang uh so this is supporting the editor for inspections refactoring and so on syntax highlighting that kind of thing also yeah yeah exactly then uh the app code release that's mostly been focusing on swift this time around because that's a big release for swift but um because there's other shared code base with c line it gets all of the C++ stuff as well. So all the things like user-defined literal support, which will be handy for that Ruby times example
Starting point is 00:17:12 we talked about earlier, digit separators, some things to do with overloads involving variatec templates we finally got right. So that's all good stuff in both those tools. Then ReSharper c++ so that release should be coming out tomorrow uh that's got a load of great stuff but one i really want to talk about because uh this is really fun actually uh it's called post fix completions
Starting point is 00:17:35 and what this lets you do is you can you can type a dot after a variable name or an arrow if it's a pointer and as well as all the normal completions you might get, like methods on a class, you'll also get things like if there's a free function that operates on that type, you'll see that in there as well. And if you complete that, you'll then rewrite it to a function call. So this is the closest we're going to get for a while to the uniform call syntax. You guys are jumping ahead there. Well, yeah.
Starting point is 00:18:05 So it's not just method calls and function calls. There's a few other templates like for each. If you complete that, it will actually generate a range-based for loop for you. Switch statements can be done the same way. So it's really quite a fun and useful feature. So we're really liking that. And I want to squeeze another one in for ReSharper C++ because this one's close to my heart.
Starting point is 00:18:28 It now supports Catch as a test runner. Oh, there you go. Particularly pleased about that. It's not quite in C-Line yet. That's going to be in the next release. That's already on the plan. So there's actually a few things I need to do in Catch
Starting point is 00:18:41 to round out that support, particularly for being able to rerun individual tests. So that one's on me when I get back onto Catch. You know, just kind of maybe a side segue a little bit here. You mentioned that you're now supporting digit separators. Yes. And I know they were added in C++11, but I only, I think for the first time last week, actually found myself thinking, man, I could really use some digit separators here so I could parse this code mentally, parse it. I think they're actually added in C++14, weren't they? Oh, were they? Yeah. Maybe that's why I haven't used them until recently. Well, perhaps that's true. Yeah. I think they're one of those things that
Starting point is 00:19:18 you forget about them and then when you really need them, they're really useful. Yeah. So you mentioned Catch there. Do you want to tell us a little bit about some of the recent work you've been doing there? You're still working actively on Catch, right? So I am definitely still working on Catch. If you've been following it, it might have seemed a little bit quiet recently. And when I took the job at JetBrains, I was actually expecting to be able to spend a lot more time on it. In fact, that was actually expected as part of my role to to work on open source software in practice I've
Starting point is 00:19:50 actually spent the last few months just ramping up learning lots of new stuff grabbing extra conferences and meetups and talks doing my first screencast even a webinar and podcast of course so catch has just taken a little bit of a back seat for a while but i'm really hoping that at the beginning of the new year i'm going to start cracking on with that um i've actually got a massive backlog now of issues and prs to go through but the main thing is i've started work on catch two and i wanted to talk a little bit about that if that's okay yeah yeah so the the major premise of catch 2 at least internally is that it rebases on c++ 11 and i mentioned this a while ago on twitter and uh you jason sounded a bit surprised that it wasn't already on c++ 11 yeah it actually works on c++ 03 and there's a lot of
Starting point is 00:20:40 people rely on that so we're going to need to support that for some time yet. But in many ways, that's really held back the code base. So I'm effectively going to be forking the code base now. So Catch 1 or Catch Classic, whatever we call it, is going to go mostly into maintenance mode. So it'll still be supported, but probably won't get any new features. I'm going to concentrate on Catch 2. As you know, anytime you switch to C++11,
Starting point is 00:21:08 you can potentially change almost every line in your code base. So I'm actually taking the opportunity to rewrite some large sections of it as well, particularly the core. And the main reason for that is that things have actually changed quite a bit from when Catch was first released six years ago this month, I think, because originally it was conceived as a pure unit test framework and mostly just for my own use. I only push it out just to see
Starting point is 00:21:29 if other people might be interested in it. And over the last few years, it's actually got quite a bit of a following. So now used in a lot of diverse projects with differing needs. And there's a couple of limitations that come up quite frequently. That's both runtime performance
Starting point is 00:21:44 and compile time performance so they weren't really you know part of the original goals of the framework so on the compile time side i mean there's already some tricks that i use to try to minimize the effect of it being a header only library so we're cheating a bit in a way because compiling most of the implementation into a single translation unit but i do still get complaints about the compile times and that's a real concern, especially if you want to do TDD, for example, because that really relies on rapid feedback. And, you know, long compile times can really halt that. So I know where most of those
Starting point is 00:22:16 bottlenecks are. It's just a lot easier to deal with them if you sort of redesign without having them there in the first place. So taking that opportunity. I've actually now got my proof of concept core down to zero standard library header dependencies. Wow. With minimal templates and no unnecessarily aligned functions. So the compilation overhead is effectively zero. There's still a little bit to add because that's just my proof of concept, but I'm pretty confident I'm going to keep that overhead really low and it's going to make a big difference
Starting point is 00:22:47 so i'm quite happy about that so then that was the compile time performance the runtime side that was explicitly a non-goal of the original design so there's plenty of you know string copies locally scoped string streams small heap allocations you know all those things that really add up when you start to scale really add a significant overhead and one of the things i want to do next is to add test data generators so if we're running many multiples more times the number of tests for each of these pieces of data that's really going to add up even more so really need to address this and one of the ways i'm going to do that is by optimizing things like string copies and string conversions and i'm going to introduce a string class that i've designed it's an immutable string class
Starting point is 00:23:35 and it's one that i've been talking about recently in my talks on functional c++ which allows because it's immutable to more efficiently share copies as we copy these strings around by going back to a reference-counted implementation. So in your effort to get started on Catch-2, did you use Clang Modernize or did you use any tools like that to help you start to update the codebase? No, I've concentrated to begin with just on that core that I'm rewriting from scratch. Once I've got that up and running and I start to update the code base? No, I've concentrated to begin with just on that core that I'm rewriting from scratch. Once I've got that up and running, and I start to reintroduce the rest of the code base or the infrastructure around it for running tests and command nine and all the boring stuff,
Starting point is 00:24:16 then I'll probably look more to tools to help with that. But I haven't done it yet. So and this is again, maybe going a little off on the weeds, but I recently started thinking, well, maybe I should update my open source projects to be C++ 17 just to learn from that process. Is there any chance you considered skipping right over 14, 11, going straight to 17? I would love to. But I'm trying to keep catch still appropriate to a large user base. And C++ 11 is well established. And now yet that that's going to be plenty of people, but,
Starting point is 00:24:49 but even 14 is stretching it a bit. I had considered going to 14 at least because that would at least allow me to possibly use ranges for the, for the data generators. But that would then involve a third party dependency because it's not in the standard yet. So I'm considering that. But 17 is a bit too far yet. Okay.
Starting point is 00:25:12 So you recently gave a talk at the St. Petersburg C++ user group on functional programming in C++. Would you say that functional programming is now possible in C++ with 11 and 14 lambdas? So before I answer your actual question, I just want to back up a little bit and say that I've actually given that talk five times now just in the last month. Oh, wow. Oh, goodness.
Starting point is 00:25:34 Including at meetings in C++. And I'm going to give it for a sixth time next week in Munich. You could just recite it right now without any notes or anything, I would imagine. Possibly. That's pretty much what I did the last couple of times the the st petersburg one though um that's the only one that has a video online so far i think there's a couple of other recordings i don't know out yet uh which is unfortunate because i was actually ill on that day and i didn't don't feel i actually gave my my best effort but that one was hosted at the the jet brains offices in st
Starting point is 00:26:04 petersburg so i was visiting there for the week so that worked out quite well so back to your question though functional programming is is only really tangentially related to lambdas okay and actually the very first point that i make in those talks is that functional programming is about a coding style that works with expressions rather than statements it makes that contrast and that's really the root of it all the other things you think are about functional programming sort of hang off that that single concept so then i get into how you might do that in c++ to a point at least because obviously c++ has statements but you can write things in a more expression oriented way
Starting point is 00:26:41 and sometimes that even involves lambdas, but not necessarily. So actually most of the talk was more about how we can work with immutable data. There's the section on the immutable string type that I mentioned that I'm going to be putting into Catch and quite a bit on persistent data structures. I'll also talk a little bit about monads at the end. Monads, the things that you can only know if you've seen one
Starting point is 00:27:07 you can't be explained what they are something like that i'm not sure what you mean yes it seems like every description of monads seem to be oh i finally got monads so i'm going to make my own description of monads and no one understands anyone else's description. I find the most successful attempt to explain monads is to not explain them, just to demonstrate them in use, and then say afterwards, oh, by the way, that's a monad. Yes, that's pretty much what I was trying to say, yeah. So is there anything in C++ that's really holding back using it as a functional language? Or are you saying, I guess, your answer basically said we can do functional programming in C++?
Starting point is 00:27:51 So C++ has plenty of restrictions in this area. And I don't think we'll ever see it become a pure functional programming language. And I doubt anyone's actually surprised by that statement. But I think the main limitations are the the mutable by default approach everywhere um you can work around it uh but it's a lot of work just adding const everywhere making sure that things you point to a const as well and you have to do the transitive part yourself so that there's no guarantees and that's one of the the big limiting factors functional programming gives you guarantees that c++ just just can't do
Starting point is 00:28:25 say the use of statements everywhere instead of expressions again you can sort of work around it but it's it's not natural you end up just really fighting the system so i don't think we'll ever be able to make c++ a functional programming language but we can employ certain functional programming techniques within the language we do have to to get the benefits in certain parts of the code base while also stepping away from that in other parts of the code base where it makes sense to do things differently and get different benefits so it's quite a nice approach to to mix the two i think are there any c++ features you're looking for that might help with functional programming and the current
Starting point is 00:29:05 efficiencies? So one of the other limitations I forgot to mention actually was that the standard algorithms, particularly the higher order ones that take or return a callable object, they're not composable. So you can't sort of pipe them together, for example. That's a problem that's actually fixed by the ranges library so i'm really looking forward to to ranges coming for for that reason if you haven't seen eric niebler's talk at cpp con last year then you really ought to do that that should explain why i'm so excited about that um of course you can get ranges now on github but that's actually only half the solution because as well as ranges ranges themselves, you also need the ranges-aware version of the STL algorithms to work with. And it's composing those together with a little bit of extra sort of magic helper functions that gives you the ability to write monads in C++.
Starting point is 00:29:59 Yeah, I'd also like to see pattern matching in the language. We've got a little bit of a teaser of that in C++17, assuming it still makes it in, in the form of structured bindings. But I'd really like to see something more fully fledged, perhaps growing that out of the switch statement. That's what they've done in Swift. It works really nicely. And just to explain, pattern matching allows you to match the shape of the data you have. So for example, if you've got a tuple with three elements, you can match that shape. And at the same time, you can extract out the individual elements from that tuple, give them individual names. And it just really cleans up and makes a lot simpler than otherwise quite messy code.
Starting point is 00:30:39 Interesting. There was some, I thought, a proposal from Bjarne from a long time ago about adding pattern matching, but I don't believe it's resurfaced in recent standard efforts. I've lost track of what the current status is, but I've seen a number of proposals for pattern matching which have received different degrees of interest. So it's something that keeps coming up. I'm just not sure if it's going into any of the actual standards themselves yet. I haven't seen it.
Starting point is 00:31:08 Okay. And just regarding destructuring being added in C++17, structured bindings, one of the notes in Michael Wong's article that we discussed was that they did a couple of refinements to it to make sure that it works in even more contexts. So I think it'll be good. Yeah, I saw that. And my main takeaway was, good, they're still keeming in. Right.
Starting point is 00:31:35 You mentioned Swift there for a moment. I know Catch started off as both an Objective-C and C++ test library. Does it support Swift as well? No, it doesn't. Swift is a different language. Right. It can interoperate with Objective-C via effectively a co-generator at the back end
Starting point is 00:31:56 that passes everything via C types. So it can interoperate via C or via this co-generator. But pushing that to C++, I think you could do it, but I just don't think it would be worth it. There's some very good Swift native test frameworks that were going to do a better job. Okay. I guess staying on the Swift topic for just a moment,
Starting point is 00:32:14 and correct me if I'm confused here, but you've mentioned Swift in relationship to AppCode, and I'm not familiar with the AppCode product. Can you tell me what it is? Yeah, so actually AppCode was the first JetBrains product to support C++, if I'm not mistaken. It was originally just Objective-C, and C++ was added. And C-Line grew out of that, effectively taking the C++ part and detaching it off into its own product. It now has a lifetime of its own.
Starting point is 00:32:44 And of course when swift came out it started supporting that but it's it's really just for mac and ios development uses the xcode project format interoperates with xcode and the the apple tool chain you know very tightly so you are really restricted to that environment but when you're in that environment it's really great because it gives you very powerful refactorings and code navigation and generation facilities that xcode just doesn't give you interesting i know some people aren't terribly happy with xcode so and i didn't know app code existed ah well now you know i'm thinking to myself it's been quite a while since i've used xcode but i guess
Starting point is 00:33:25 xcode probably doesn't support plugins or anything and that's why app code is created as a completely separate ide that is mostly true okay it does support plugins there was an old plugin format which i wasn't too familiar with i think you had to get a bit hacky to make it work well but you could do a few things with it uh recent versions of xcode they've really restricted what you can do with plugins but they've made it a much safer more well-defined system so the the promise is that if they grow that support in future versions of that code you'll be able to do something like the the app code refactoring code generation code completion features as a plugin but you can't quite do it yet. And I believe the intention, I can't really speak for the team, but I believe the intention is that when that does become possible, we probably will do something in that space.
Starting point is 00:34:12 Okay. I'm kind of curious, also, since we're talking about JetBrains tools again, you said that Catch is coming to ReSharper++ and then eventually to CLion. I'm just kind of curious what that support would look like from an IDE, since to sea lion i'm just kind of curious what that support would look like from an ide since i'm not really an ide kind of guy and i'm just used to typing you know c test and then letting that run my catch test actually like yeah so resharper c plus plus has its own test runner uh in fact sea lion does as well that look very similar so you do get a gooey representation of the tests as they're running. So you'll see tests appear in a list, red or green, depending on whether they passed or failed.
Starting point is 00:34:51 And if you click on those, it will take you to the test output, as well as the line of code in your test suite that was responsible. You can also do things like filtering the list down by text or by completion status. And Ketch has some really good hierarchical grouping of your test and then, you know, how many assertions you have. Do the IDEs show you all of that also, or will they? They do, yes. In fact, I've just finished recording a screencast for the ReSharper C++ release, which demonstrates demonstrates exactly that so hopefully that will be out tomorrow you can go and have a look at that i'm not sure if i'll be able to give you a link for the show notes uh depends on the timing of things but uh otherwise you should be able to find that
Starting point is 00:35:33 easily enough that's pretty neat you you mentioned earlier uh that you were doing webinars too what what sort of content have you been putting out with these webinars and screencasts so the webinar i've just done one so far. That was at the beginning of this month. It was actually hosted by JetBrains and I did a little segment, but it was mostly to give UndoDB a chance to show off their integration
Starting point is 00:35:55 with C-Line. I know you've had the Undo guys on the show before as well. Yeah, so that was mostly their show and I just talked a bit about general debugging on CLion. Yeah, that's pretty cool, too. I didn't know Undo had CLion integration now. Yeah, that's quite new, hence the webinar.
Starting point is 00:36:12 Right. Going back to Catch, are there any C++ features that you'd like to see added or removed to make Catch easier to work? Not really sure if you're thinking much about this since you're saying you're going to be targeting C++11 but anything you might be hopeful for with c++ 20 for catch yeah so just moving to c++ 11 alone is going to be a massive win just in terms of cleaning up the code base and making much much nicer to work with uh but i did allude to uh ranges coming along
Starting point is 00:36:41 being being quite nice because if that's in the standard, I can rely on it without any extra dependencies. And that can really have a big impact on how I provide generators support. And that's going to be quite important because I want to build on top of that a property-based testing setup. There was also a proposal, I believe it's still ongoing, I think it may have slipped into C++20 now for compile time reflection. And I know that test frameworks is one of the major use cases for that. So that would certainly help make test discovery more robust and remove some of the more complex macros
Starting point is 00:37:17 so they wouldn't really change things much for the user, I think. See, now I would have thought that scripting engines would have been the main use case for reflection at compile time. Perhaps the main use case for reflection at compile time. Perhaps the main use case, but I know test frameworks are one of the cases that they're considering actively. Yeah, I know. I'm just kidding. I actually haven't looked into what the consideration is. I just know that I would like to see it. Yeah, as far as I know, it's all still going ahead, but no planned completion time yet. Okay. Is there anything else you wanted to go over that we haven't already asked there's a couple of things actually uh just to round out
Starting point is 00:37:51 uh just going back to to jet brains again so if you're a student or a teacher or a key maintainer of an open source project you probably qualify to get a free jet brains license so it's worth checking up on that a lot of people uh don realize that, so they're missing out on free tools. There's also some other free or discounted options. So if you go to any of the product pages and go to the Buy tab, then you can see all the discount options there. So it's worth checking those over. Also, if you run a user group, you may be able to get a JetBrains sponsorship, which will let you raffle free licenses at the group.
Starting point is 00:38:29 And talking of meetups, if you're in the London area, I've just started a new C++ meetup group there. And we should have a second meetup in the new year. So you can find that on meetup.com as CPP London. Of course, we're sponsored by JetBrains, so you might win a license there. And I'm also looking for speakers for the group. So if you've got any ideas, please let me know. If you will pay travel expenses, I would be very happy to speak at your meetup. Maybe we can talk about something there.
Starting point is 00:39:01 I'm sorry. I missed some of that. So the C++ London meeting group is new? Yeah it's brand new just had our first meeting last week it's a big success I'm surprised that there wasn't already a big C++ user group in London
Starting point is 00:39:15 Me too in fact there is a group the ACCU London group which often concentrates on C++ but they're more diverse so they cover languages and topics and some people that they just want something more c++ focused or they they're not quite sure what the accu is so i felt there was still a gap in the market and uh i just stepped up okay uh well phil um where can people find you online or find more information about catch and uh and
Starting point is 00:39:47 obviously some of the jet brains updates yeah so on twitter i'm phil underscore nash uh most other places including github i'm phil squared and of course on meetup.com cpp london we just mentioned have a website uh level ofindirection.com. And as I always like to say, you can also get there via extralevelofindirection.com. This redirects. And of course, jetbrains.com. And it's important to remember that you're Phil Squared on GitHub because searching for catch can be difficult. Yeah, that's one of the reasons I went with catch2 as a name.
Starting point is 00:40:26 Good idea. occult yeah that's one of the reasons i went with catch two as a name that's a good idea yeah even if you search for a c++ catch you're not you're not going to find the unit test library yeah okay well thank you so much for your time today phil thanks guys thanks thanks so much for listening in as we chat about c++ i'd love to hear what you think of the podcast please let me know if we're discussing the stuff you're interested in, or if you have a suggestion for a topic, I'd love to hear about that too. You can email all your thoughts to feedback at cppcast.com. I'd also appreciate if you like CppCast on Facebook and follow CppCast on Twitter. You can also follow me at Rob W. Irving and Jason at Leftkiss on Twitter.. And of course you can find all that info and the show notes on the podcast website at cppcast.com. Theme music for this episode is provided by
Starting point is 00:41:11 podcastthemes.com.

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