Skip to content
PodSubs
ShowsPeopleGuestsJobsNewsEvents
More
BlogPodCred
Menu
ShowsPeopleGuestsJobsNewsEventsBlogPodCredNetworksSign in
Join nowSign in
  • Shows
  • People
  • Jobs
  • News
  • More
    • Guests
    • Events
    • Blog
    • PodCred
    • Networks
    Join nowSign in

ADSP: Algorithms + Data Structures = Programs

ADSP: Algorithms + Data Structures = Programs artwork

Episode 114: Rust, Val, Carbon, ChatGPT & Errors with Barry Revzin!

Jan 27, 202344 minAudio

In this episode, Conor and Bryce talk to Barry Revzin about Rust, Val, Carbon, ChatGPT, error propagation in C++26 and more! Link to Episode 114 on Website Twitter ADSP: The Podcast Conor Hoekstra Bryce Adelstein Lelbach About the Guest Barry Revzin is a senior C++ developer at Jump Trading in Chicago. After programming for many years, he got really into the nuances and intricacies of C++ by being unreasonably active on StackOverflow (where he is the top contributor in C++14, C++17, and C++20). He is also a C++ committee member, having written dozens of papers for C++20 and C++23. Show Notes Date Recorded: 2023-01-15 Date Released: 2023-01-27 ADSP Episode 113: The C++26 Pipeline Operator with Barry Revzin! P2011 A pipeline-rewrite operator P2672 Exploring the Design Space for a Pipeline Operator Rust Programming Language Rust Traits Swift Protocols Rust std::iter::Iterator Rust The Cargo Book Val Programming Language Carbon Programming Language Carbon Operator Precendence Epochs: a backward-compatible language evolution mechanism ADSP Episode 97: C++ vs Carbon vs Circle vs CppFront with Sean Baxter Circle Compiler ChatGPT: Optimizing Language Models for Dialogue GPTDuck Oxide and Friends Podcast Bryan Cantrill on Twitter Bryan Cantrill: The Summer of RUST On The Metal Podcast Oxide and Friends: NeXT, Objective-C, and contrasting histories Elixir Docs Rust Docs P2561 An error propagation operator Sy Brand’s tl::expected P0798R4 - Monadic operations for std::optional C++23 std::expected Chicago C++ Meetup: Defining Range Formatting

Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.

Transcript

From the show. Tap a time to play from there.

Barry RevzinBut I think if anything, maybe even the more the more compelling side is like all the tooling around it. Obviously, it's nice when you're just like a newer language, right? Like Rust has the benefit of being like 30 years newer than C. So as far as the other languages go, the one that I find the most interesting is actually Val.

ConorWelcome to ADSP the podcast, episode 114, recorded on January 15th, 2023. My name is Connor, and today with my co-host Bryce, we interview Barry Revson and talk about Rust, Valve, Carbon, and the C26 error propagation proposal. And maybe we'll maybe we'll turn this into like a mini Rust episode, because we're in our Rust phase of our podcast. We've temporarily turned into a Rust podcast, kind of. And at the tail end of this paper, you mention sort of off-handedly that this would all not be necessary if we had something like Rust traits or Swift protocols.

ConorAnd one, I wanted to get your thoughts on why is that the case for everything? Like, for instance, a zip transform. Like could you implement a zip transform where you're doing sort of the piping twice? Is that possible in the Rust traits or Swift protocols? And also two, when you finish answering that question, thoughts on Rust? Are you a Rust expert secretly? Because you do um, you know, you've done a talk where 33% of it was on Rust, and uh you make references to Rust.

ConorSo yeah. Two questions there, both about Rust. Um and Swift if you want.

Barry RevzinYeah, so uh uh so no trades and protocols wouldn't subsume every possible use case of pipelining with placeholder. Um they would subsume every possible use case of pipelining without placeholder, um, because that's basically what what they what they do um or you well. Um right. So if you look at like what what Rust Iterator is, this is basically a collection of functions that you can call with like regular dot syntax. Um and that that does what we think of as piping, right? It just it just works. Um there's no again, there's no library machinery there that just like works in the type of language.

Barry RevzinUm but but that is like the the left threading model of placeholders, if if you will. So if you want to do anything that isn't that, um that's not gonna help you at all, right? It's not gonna help you pipe into the second parameter, it's not gonna help you pipe multiple times. It's not gonna help if the thing you want to pipe into isn't a function call. Um, because it's it's just it's just function calls, right? Um so similarly, this is like will unified function call syntax be a solution to this? Well, one of the problems is like, well, some of these things are objects and some of these things are functions, and you want to deal with like this like weird overload or loose in between like things that we don't really have before, and unified function call syntax has its own set of problems.

Barry RevzinUm and so I I don't know. Like, I mean, personally, I think Rust rates are are really nice. Um, and I would love to have something like that in the language. And if we had that, then the question is like, well, would the additional value of placeholders um still be worth pursuing? It would certainly be a much smaller problem. Um and I don't I don't know that it would end up being as compelling. But given that we don't have anything like that, uh then the set of problems that this would address becomes a lot larger.

Barry RevzinUm and so I I think it's a much more motivating feature as a result. Um am I a Rust expert? No. Uh definitely not. Um I have written maybe a few thousand lines of Rust code at this point, mostly for like solving advent of code problems. Um but not anything like real in any sense. I just find the language interesting. Um and I I just like worrying things about it. But um and I know even less about Swift. Uh the the extent of my knowledge of Swift is like reading random docs and like asking Dave Abraham's questions on occasion.

ConorAlright. Well, and while we're talking about uh um Rust, any thoughts on the general? I mean, we've I asked Jason this when he was on. So I'm not sure if we've asked every guest since sort of these this has happened, but the whole carbon circle, Rust, CPP2, thoughts on this whole uh, you know, the Empire Strikes Back year of 2023.

Barry RevzinSo for Rust specifically, so there's two things that two broad things that I think are super compelling about Rust. Um one is of course like there's a lot of nice things in the language that just like make a nicer program with like the the whole the whole bar checker thing, trades, like there's a lot of just like nice things. Um a lot of the syntax is is terse in a way that I think is a little jarring when you first come into, but then once you start, once you like deal with it enough, um and I'm hardly an expert, but so like I but I already feel like I'm past the enough stage. Um, the fact that things are terser is just like nice, right?

Barry RevzinLike the fact that functions are just FN and the fact that you have like I32 and U64 for all your types instead of having to write out all this stuff is is just like a nice um quality of life thing. Um but I think if anything, maybe even the more the more compelling side is like all the tooling around it. Um obviously it's nice when you're just like a newer language, right? Like Rust has the benefit of being like 30 years newer than C. And so there's uh there's a lot of stuff that has changed in like the wide world of programming um from 1980 to 2010. I don't remember exactly when Rust was first created, or um somewhere around 2010.

BryceYeah.

Barry RevzinGive or take a few years. And so um I had a coworker recently, um, John Shaw, who gave a talk to us about this project that he's working on, like for for actual like work um in Rust. And this guy's a great C programmer. Um and he's always been kind of like a Rust evangelist, but he this this is the first time that he's actually done like real things um for a while. And this project's like, I don't know, 50, 100,000 lines of code, it's like a real thing. Um and most of the stuff that he's talking about was like the tooling environment. The fact that like stuff just works um is is super nice.

Barry RevzinLike every uh if you want to rename a variable in your IDE that just works. Like this is something that has never worked for me in C in any IDE that I've tried. Even even if I'm like renaming a local variable in a function that's only used in that function, it just like never works. Um it always takes forever, it's it's always broken. Um we have all these other issues with like build independency stuff. And and sure, when you start doing like especially complicated things, cargo kind of breaks down. And I've heard a lot of like people complain about, especially if you're doing cross-language stuff, but like there's a lot of stuff in cargo that's just like really easy.

Barry RevzinThere's a lot of tooling that's built on Rust that's just like really easy um in a way that is just not for us. Um and and if anything, that was like the part that was like most evident about me. Like, if I could get like all the tool ability, but like stay in C, I'd I'd probably be a lot happier. Um so as far as the other languages go, I don't know. The one that I find the most interesting is actually Val. I've I've no idea how Val is supposed to be backwards compatible with C ⁇ . It seems like a completely different language model.

BryceUm in some wait, that's a guarantee that Val's making? I I don't think it is. I think Val is a is is an experimental language and does not my understanding was that that there's no intention that Val be backwards compatible or that Val necessarily be a uh uh you know a production grade language, that it it's meant to be an experiment, uh uh something that uh you know maybe other languages will learn from, maybe that will grow with time.

Barry RevzinBut that that was just my I do think I do think it was intended to be interoperable. Oh backwards compatible is probably the wrong word.

ConorI just cement the website. Yeah, it's the the number four thing is it says interoperable with C. Programming languages rarely survive in a vacuum. Val aims to take advantage of the vast software capital of C by supporting full interoperability.

Barry RevzinSo I have no idea how that's supposed to work because the model in Val seems to be very different um than the C model. Um but there's a lot of cool stuff about it that that I find pretty pretty appealing. Um some that we might even want to consider trying to see to what extent we can pull into C. Um some of the other ones I guess I just like don't don't get. Um maybe this is just one of those things that I just like don't understand. Like I just I don't understand carbon. Uh just like kind of fundamentally. Um I I I don't understand the selling point.

Barry RevzinUm of the big things that people are talking about these days is uh you know a lot of stuff about like safety, right? Um how safety is important, and like that's that's one of the major selling points of Rust is that you have a lot of things that are just compile errors um instead of you know figure out how to run sanitizer to cache the same kind of errors. Um and but like carbon doesn't answer that, right? Um or or at least it had it had no answer to that question the last time I looked at it.

Barry RevzinUm and like so you know when I look at it, there's a lot of things about there that are that are nice. Like it's it's a nicer syntax, it has some nicer, nicer language features. Um it's going like the trade approach of customization, which is which is I think the right approach, and that's nice. Um one of the small things in there that I really liked was the operator precedence model that they had. Um I don't know if you guys looked at that.

ConorYeah, it's that uh flowchart diagram.

Barry RevzinYeah, like the fact that um uh uh operator precedence isn't a total order. I think that's a very cool way of doing it. Um and that's probably like the right approach. I don't think I've seen other languages do it that way, which in retrospect I find kind of surprising. Like everyone tries to define some total order on operators, but sometimes like there's no obvious precedence. Um so they just don't define one and make it ill-formed. I think that's pretty cool. Um but other than that, like I don't I don't know why I would use it, I guess.

ConorYeah, I think their their pitch is that they're hoping it's you know the the cot Kotlin is to Java, what carbon will be to C. And uh I think if they deliver on their goal of you know hitting a button that can, you know, I'm not sure if you've seen any of the Google IO talks that when back a few years ago when they were sort of making promoting Kotlin from a whatever silver language to a golden language or whatever terminology uh Google uses, they had these demos where they would show you this, you know, 60 lines of Java code and you click a button and it turns it into three lines of Kotlin and it was all automatic uh uh automatically like converted.

ConorIf they deliver on that promise of being able to sort of migrate your C code to carbon code, I think that's that's compelling. The question is like, is that is that something that's actually gonna be possible, or is it like, well, if you are in the sandbox of C ⁇ and you stay in that sandbox, we can convert your code, but if you start using you know features that aren't because that's that's sort of my big question is like if you're gonna create a new language, how do you map like how do you have feature parity when you're completely changing certain things?

ConorBut hey, Google's Google, so uh we'll wait and see.

Barry RevzinYeah, like so what one of the things that I think is kind of important for us that you know we kind of briefly have discussed on occasion, but like really kind of drop the ball on and and should come back on is this notion of well like so like like what we see in carbon, what we see in CPP2, is that no, there there are changes that we want to make to C ⁇ that you know I think people wildly agree that these are changes worth making, um, but that we can't make in C because of source compatibility, right? We have this strong promise of well, if you compile your code with today, that it'll do the same thing with C ⁇ tomorrow and C the day after that, right?

Barry RevzinUm and when we when we when that doesn't end up being true, like we try very hard that like, well, it's not true because like your code sucks and is bad, and so if it doesn't compile, that's probably a good thing, so you should rewrite it. Um but sometimes ends up like with the comparison operators stuff in C20, where like a lot of your code is just randomly broken and you have to rewrite it, even though it worked totally fine before. Um and that sucks, and that I I think that's like widely considered to be a mistake, like whenever we do stuff like that. Um but imagine we lived in a world where like we could make breaking source changes in a way that didn't actually break code.

Barry RevzinUm so this was you know, Vittorio um Romeo had this proposal, which he called epochs for some reason, but I'm just gonna refer to as editions.

ConorWell, you know why? Because uh Rust editions were initially called epochs. Were they really? And then they change they changed it at the 12th hour because uh I can't remember there was maybe ambiguity in the pronunciation, and like some people were s anyways, they changed it to editions for marketing reasons, I think.

Barry RevzinWell, it's a much better name anyway, because epoch is already a thing in like when you when you talk about time and clock, um, so it's nice to have a distinct word. Yeah. Uh yeah. Yeah, so like you know, imagine if you know at the top of your and modules provide like a good boundary for that. Like Vittoria made this point. There's a different paper from Nathan Myers that also kind of made this point of like um well, like modules offer us like a nice opportunity to introduce uh these like notions of code that aren't just like header textual inclusion, um, and we could take advantage of that to make advancements.

Barry RevzinUm and so like if we if that was something that like we meet could made concerted effort on, and we had this model of like breaking source compatibility and making changes to the language that like old code would continue to work, but like new code could be improved. Um like how many of the problems uh that these uh successor languages are trying to solve could just be could just be C. Um certainly like any syntax changes we could just make because it's just syntax.

Barry RevzinThe semantic ones are kind of harder, but I think it's something that we could think about.

ConorYeah, this is almost very, very similar. I'm not sure if you listen to that episode with Sean Baxter, is that uh he basically made a similar point that you know we we are a committee of folks that or you know, the C ⁇ committee, you know, and people that write C ⁇ have the ability to create whatever future for C that we want. Um we just have to decide what that is. And it d do you know what the because the Vittorio's paper went to, I can't remember if it was Evolution Working Group Incubator, but it like it got shut down at some point.

ConorDo you know what the reason like reasons for that were?

Barry RevzinWell, I don't I don't know about shut down. I think that's probably the wrong phrase. So well one of one of the issues is that there's a you can't necessarily do anything on uh on an addition boundary. Um and there are issues that you have to work through. So so one of the one of the examples that he had in his paper for like this is something that we could change um in a language, is like uh implicit conversions between int and float, for instance. Right? Today int is implicitly convertible float, maybe tomorrow we want to make it only like explicitly convertible to float.

Barry RevzinAnd so one of the one of the issues with those kinds of rules is that you have to answer the question of like, well, how does this what are actually the rules on module boundaries, on it on addition boundaries between code that has different semantics? Or like the most extreme version is like, well, I have three different modules, and one has a function template that uses a concept declared in another one that uses a type declared in a third one. Um how do you know which rule set to use um when these when these things interact?

Barry RevzinAnd so so that that question isn't answered in the paper right now. Um but like that question could be answered. There are probably reasonable answers to that question. And one of the reasonable answers to that question might be that, well, maybe we just can't make these sorts of semantic changes, and we have to limit ourselves to making like syntactic ones. But even if even if that's the answer, um, which I I'm not sure that it necessarily is, like I'm but you know, I haven't really thought about this problem at length.

Barry RevzinUm there are still a fairly significant amount of syntactic changes that we could make that would have a lot of value. Um even if like just like removing type def or like or silly things like that. Changing changing the type of string literal for some from something that is terrible to something that's useful is almost certainly a change that that we could make. Um that would be that would be like a nice thing to do. And and these are the kinds of changes like, well, we can't make we we can't like change the type of a string literal today, because like there's a tremendous amount of code that depends on the type of string literal being what it is.

Barry RevzinUh but if I have new code that wants to opt into the new rules, maybe we could. And then suddenly ranges algorithms could just work with string literals instead of just being horribly broken. Or best case, not compiling. Uh that would be that would be a nice feature.

ConorWell, sounds like you've got a paper that you can add to your list of tens and tens of papers, maybe even hundreds. Do you know how many papers you've written? Because I know you have a GitHub repository that uh Uh no, I have no idea.

Barry RevzinAnd I don't know the numbers to any of my papers, so either there's too many of them.

ConorYeah, that's fair. I mean as Bryce Bryce mentioned, Empire Strikes Back, 2023. I also I was telling uh I was trying to explain this to a friend that doesn't understand Star Wars and they were completely confused because I thought it was just a a wonderful analogy um that uh 2022 was a new hope and uh all this stuff.

BryceYeah, my girlfriend is Alta did not think it was that great, but she hasn't watched Star Wars. C.

Barry RevzinOkay.

BryceThe C committee and the C it's that last year was a new hope. All the all the all the rebel languages popped up, and now um now uh the Empire is gonna come uh storm their base on the code.

Barry RevzinSo that what we're just gonna like murder people? Is that is that what we're doing now? I don't I I don't know if I'm I'm on board with this metaphor.

BryceNo, but I will say that the C committee, that the ATAT is definitely something that the C plus plus committee would design. Like that that was definitely a vehicle, it should have been like it should have had wheels and said they gave it legs, and like it has like a turret on the head, but like a very limited uh like firing radius. Like that was definitely designed by by I don't know.

Barry RevzinI think I think it's way too close to being a pronoun acronym for something to come out of C.

BryceThat is a good point.

ConorOne thing about that analogy that I'm not sure if I'm you're sitting on this and you're waiting for uh uh you know 50 episodes to go by till next year's retro and predictions for uh 2024. But uh my my theory is that you know you think 2023 is the Empire Strikes Back and that 2024 was gonna be Return of the Jedi, where one of the successor languages uh you know prevails. The question is which successor language is Luke Skywalker? Uh you know, is it Rust? Is it Val?

BryceWe gotta I mean I I I think conservatively speaking, you gotta bet on Rust um just because it's got the most momentum behind it. And like I'm a big believer in in momentum uh being uh uh triumphing triumphing over almost any other uh uh uh merit in the software world. Like, you know, what one of the reasons why why C ⁇ has been around and has been successful so long is momentum.

BryceAnd one of the things that keeps C going is momentum. And um you know, one of the reasons why I've I'm typically skeptical about um uh you know successor projects and and things that try to, you know, sort of sort of doing a rewrite or or starting starting from scratch is that uh they don't you know initially have momentum. And that makes them, you know, high even if they're 10x better on on a variety of technical merits, um, without momentum, uh you you're the odds are against you.

BryceBut Rust now has the momentum behind it, and it's also got you know lots of technical merits. And and I think um these things sort of start to snowball. Once you build enough of a community, once you have enough uh once you're in enough places, um then it it it just becomes easier and easier for your your technology to be adopted and it'll grow um uh more popular, you know, even more rapidly. And so I I think out of all the successor languages that we've talked about on this podcast, I think Rust is the one that's um most likely to take over the world um simply because it's been around longer and it's got more momentum.

ConorYeah. It'll be I'm this the next couple years is gonna be very exciting for podcast hosts. And I mean just people in the systems programming language space, even if you don't have a podcast, but we get to ask folks about this, and it's super interesting to hear people's thoughts. But yeah, like it is uh it's like you were talking about your coworker, Barry. The biggest thing that like impacts how I write code in that language is that everything just like comes out of the box. The equivalents in C, you know, Clang format, Rust format's just there, you know, static analyzers, Clang tidy, uh clippy is right there.

ConorUm just everything just works so nicely, you know, cargo package management, I want to pull something down, super easy, you know, where I I gotta go choose a build system in C and Heaven forget, heaven forbid. I mean, this is one thing that I've been talking about. Chat GPT. If if you can point ChatGPT at a GitHub repository, and there is a website that my buddy showed me, it's called gptduck.com, I think. You have to sign up for it and it might may even cost money, but like you can point it at a GitHub reco. And if you can ask ChatGPT to set up like a CMake file and then say, I want, I want CMake and go uh get me these packages, I want range v3, this, this, and that, and it can just go do all the build stuff.

ConorSign me up.

Barry RevzinI will say that so so the same cover for John. We so we were recently like setting up our internal compiler score instance um at jump with like a bunch of our own libraries and stuff, and we had to like set it up on Kubernetes. Kubernetes, which is something like neither of us know anything about except for that like that is a word that exists. Um and he just like asked Chat GPT how to do it, and that got him like 95% of the way there.

ConorWow.

Barry RevzinUm he was just like and he just like typed in whatever commands it told him to run, and and it was running.

ConorUm that's like that is actually like pretty pretty crazy. Like that if that's the kind of thing that I think that people are asking, is this gonna change the world, though you know, put us out of business? But like there's a ton of stuff that as devs we do that's like just jumping through hoops, you know, trying to spin something up, or and it's not that we don't know what we're doing, we just don't, you know, how often am I a build engineer? I'm not a build engineer. Like some people they know CMake inside out. We've got a uh a guy on the Rapids team, Robert, who's like used to work at um Kitware, is that the company that does C Make?

BryceYes.

ConorAnd uh, you know, he's like a he's a guru, you know. You he can he's like Harry Potter with you know CMake files. You know, you ask him to do something and he'll say the uh Vaticadavra, you know, kill a you know a wizard and I feel like the character for Who Knows What They're Doing is clearly Hermione in that series. All right, Hermione, uh that's that's true. She was the spellcaster uh and the one that Dumbledore entrusted that little time thing in the third book. Oh boy.

BryceBoy, you really don't know you're very proud of that.

ConorI've read them three or not three times, twice, but it's like uh we're old now, you know? We were we were back in high school uh when we read those books. Um anyways, what was yeah, Chat GPT. If it can do that stuff for us, that'd be fascinating.

Barry RevzinI mean, it might very well be the future of documentation, right?

ConorThat's what, oh yeah, this is a great segue because I knew I was gonna forget this because we were having you on. One of my new favorite podcasts, and I'll tie this back into documentation. You'll see why I'm going on this digression. Uh, is Oxide and Friends. So one of my favorite speakers, alongside Barry, of course, uh, is uh Brian Cantrell, who I'm probably sure like 25% of our listeners know who they are. He works at a company called Oxide, which is building some sort of low-level operating system in Rust, I think, for like embedded devices.

ConorThat could be a completely inaccurate description of what he does, but he uh is one of my favorite speakers because he's he's so energetic. Like one time he gave this talk called uh Rust over the summer and no slides. And like it's an hour and a half talk, I think, or two-hour talk. Like halfway through, he hasn't even mentioned Rust. He's just going on all these, it's anyways incredibly entertaining. And uh he has another podcast called On the Metal, but it's only like 10 episodes. But over the last couple years, they started, I don't think it's on Twitter Spaces anymore, it's on Discord.

ConorThey, him and a couple of his, you know, people that he works with, and then anyone else that wants to join would just basically hop onto Twitter spaces and Twitter spaces and record it. And uh I started listening to it and I've gone back and I'm like at episode six or seven in the backlog. Absolutely fantastic. Like the most recent one I listened to, they were talking about a book called Steve Jobs and the next big thing, next being a pun for the company that he worked at. And apparently it talks about not just like that chapter, uh, but like the early days of Sun Microsystems where Brian and a couple of his colleagues used to work.

ConorAnd they talk about Objective C, Objective C C, Swift, Rust. And anyways, just fantastic. On one of the most recent episodes, they said that like ChatGPT, if it can uh basically go and just write docs, like you point it at a GitHub repository and say, please go write the documentation for this. Like that would all like that's that is a something where it's not someone being put out of business. It's like we don't even have time to write docs right now. It's just like you getting someone to do work for you. Anyways, go check that podcast out. It has like way less subscribers than it should have. It's it's it's so good.

ConorAnyways, that's my little digression.

Barry RevzinDoc docs are hard. It's really hard to write the docs.

ConorYeah, and and good documentation when it is written well and is good. It's uh it's like game changing. Um sometimes I go to languages that have really good docs even when I want to like learn about a different language, but if I know the equivalently named thing in that language, I'll just go to that language because like it's like they have better docs, like Elixir um and their hex stuff. Uh amazing documentation. Um shout out to the folks that do that.

Barry RevzinSo again, again, another tooling thing is like Rust Doc is really nice, and everyone just uses it because it works.

ConorYep. Yeah, it's uh there's yeah, there's so many things. But yes, will Rust be Luke Skywalker? We don't know. We've only got 13 minutes left. I'm not sure if people have hard stops.

BryceI know you uh well I gotta go to the opera. Where are you gonna see? Um it's at this uh this festival called Prototype Festival, so it's all like premieres of uh modern uh opera. And uh we saw two yesterday that were really good. There was a double bill from this uh Irish composer. Um and the one we're seeing today, I think it's called In Our Daughter's Eyes, which is uh I think it's a one-man show um about a father uh reflecting upon whether or not his daughter will be proud of him.

BryceUm yeah. The one yesterday was uh was uh one of the two shows we saw yesterday was really, really good. It was called Trade. It's um about um two gay men in uh Northern Ireland or in no in like northern Dublin. Um and uh it was just it was really powerful. Um yeah, we had a great time. Yeah, it's it's very it's very it was very interesting though, because the the the language um and the uh the operatic style were sort of a little bit of a clash because it was like very um working class and uh gritty, but then they're like, you know, they're they're opera singers.

ConorAlright, okay. So we do gotta we do have to wrap this up then in the next uh 10 or 11 minutes. Error propagation, or if you want to highlight some other paper, I guess maybe you want to give an overview what the let me get the number. The number is an error propagation 2561, R1, it looks like. Yeah. I mean, this got this got briefly mentioned on uh one of the other C podcasts, uh, but they didn't really talk about it much. They just said, what is this? Um so Barry, how about you tell us?

Barry RevzinUh I saw that clip. That was pretty sad. Um I was just like, okay, cool guys. Uh yeah, so so the idea here is that um so C has a lot of different error handling models, and that's just a statement of fact. Um I'm not trying to dive into saying that you should use X or Y model um because it's better or whatever. Um but the the other true statement is that exceptions have a lot of language support, and of course, because it's a language feature, and uh that makes exceptions really nice and ergonomic to use in a lot of ways, right?

Barry RevzinSo, because you just let the errors propagate, and there's zero syntax that you have to write to do so. Um, and so that's that's really like the advantage of exceptions, is that there's zero syntax um to propagating exceptions, there's zero syntax to writing error neutral functions. Um it has it has a lot of a lot of really nice benefits. Um that zero syntax is also one of the big reasons that people don't like exceptions, is the invisibility of error handling. Um and that is that's like a fundamental thing. I'm not gonna get into like which one's correct.

Barry RevzinUh but in the meantime, like a lot of people in a lot of different contexts, and sometimes people that use exceptions for some kind of errors and don't use exceptions for other kinds of errors, um, use types like expected uh to do their error handling. Um the problem with using expected for error handling is that it's very syntax heavy. Um because you you do have to manually do this, like if not x return x.error kind of thing. Um and in addition to being very tedious to type, it's very error prone. Um it's very easy to write something that's inefficient.

Barry RevzinUm and part of the heaviness of the syntax around it is why a lot of people use macros for this. Um use them uh to do the unwrap or return pattern is is very common to see macros for this sort of thing. Um but the macros have their own problems because you have to deal with things like web time issues and where you're gonna construct this stuff. And they're also like a little bit limited, and they rely upon um if the the really nice version of the macro that lets you write like auto x equals unwrap or return y, um, which is nice because you get this, you still get like a real-looking variable declaration syntax that relies on like the statement expression extension of GCC, um, which doesn't do copy elision or move elision or whatever.

Barry RevzinSo it doesn't actually support moving, so even in cases where it should. Um so it's kind of like a weird state of affairs that we have where um a lot of people have used this same pattern, um, but like it's not like blessed in any way by the by the standard. And now that we have expected in 23, um, I expect more people will use this because I mean that's kind of the point of standardizing it, right? Um and so it would be nice to have like much better tools for handling this sort of thing.

Barry RevzinUm and so what what the paper basically is doing is like, well, let's take this thing that everyone has to write or already writes or already writes a macro for um and kind of elevate it into a language feature that does this unwrapple return pattern. Um and that that language feature of course has to take syntax, um, but we can make it take as little syntax as possible and make it make it customizable as a trait um that that says how to do that.

Barry RevzinUm and then this this has a bunch of advantages. One is that, of course, you can do it, um, and it's very syntactically light compared to any alternative that you can do, um, even compared to the macro. And we can then use that in other contexts and algorithms as a way of doing short circuiting. Um because I think I think some of the so some of the names in the paper are still kind of wrong. Um it's still it's still called error propagation, but it's not really necessarily about errors. It should probably be named more along the lines of control flow.

Barry RevzinUm where the because because Rust does this now where the new pattern um for what their question mark operator does is the the names aren't called like error or value, they're called break and continue. Um so like either you know you're continuing and here's the value that you're continuing with, or you're breaking and here's the value that you're breaking with. And so different contexts will use those things as appropriate. Um so in the typical case where I just have a function that wants to like error or return with this error, like I'm breaking out of the function with that value.

Barry RevzinBut then um, let's say we want to implement a fold. Um, one of the algorithms that you might want to implement as a fold is like a fold that stops at some point, right? It doesn't consume the whole input range, it consumes until something happens and then and then returns a value. Um and that algorithm isn't one that I added in the fold paper largely on the basis that we don't have a good way of like, well, how do you do the short circuiting? Like what is what is the shape of that algorithm?

Barry RevzinUm and having this kind of like continuation traits thing is like, well, that's how that's that's the that's the thing I use, right? Like if um if you have a you you have a short circuit in fold and like your your function returns something that is like an error continuation type. And so if that thing is an error, um which is why error is kind of a bad name. If that thing is an error, then you return with that thing. Um and if it's a can if it's a value, then you continue with that with that value. So that does that make sense?

Barry RevzinIt makes more sense in code. It's it's kind of hard to explain visually or verbally, I think. Um but that's the idea. One of the problems with C Will Sauce is that we can't we can't just use question mark, which which is what Rust uses, um, because that ends up being ambiguous with our conditional operator. Um so what I'm suggesting in the paper is two question marks, uh because that one that one isn't ambiguous with anything. Um that one has this problem that there are a bunch of other languages that have a double question mark operator. Um and for those languages, double question mark always means this one particular thing, um, which is very different than what I'm using it for.

Barry RevzinAnd different, but also like would be potentially useful for us, um, which is one of the problems with like choosing syntax or anything. Um so I'm not I'm not really sure what what the right answer there is necessarily. Um but it was pretty favorably received in Kona. So I should probably go ahead and try to implement this.

ConorYeah, this would be it would be very nice um because for folk I mean I basically used I used to use Tartan Lamas, aka uh Cybrands, uh TL expected, but I think stood expected it at least a GCC. I can't remember which one, but I remember seeing it uh on a feature list. It's been implemented um even though it's a 23 feature. Uh although I haven't upgraded the code bases. But anyways, I've always used expected because I just I like the model better. And having not having something like this, that pattern is just it's ubiquito ubiquitous.

ConorIt's everywhere. Um and it's not it's not the end of the world, but having something that basically automatically does that for you would be super, super nice. And the examples that you show in the paper are extremely motivating. For those that didn't follow Barry's explanation, just check the links in the the show notes, go to the paper, and just like find the first couple examples because it's it's similar to Cybrand's uh monadic interface. I can't remember the name of the paper is, but like the monadic uh pattern on optional. And I think I'm not sure if there's a paper for the same kind of stuff on expected, um, or it already comes comes with it.

ConorBut uh those like those examples, when you see them, uh they're just so motivating for you know, I think it's involves a cat and they're trying to get some you know food or something like that, or you're putting a bow tie on a cat, etc., adding a rainbow. And you know, the before and after code, it's just I don't know how anyone can look at that and say that the after code is less readable, like it's so much nicer.

Barry RevzinYeah, so so expected does have the monadic operators, those are already adopted. Um so those are those are M for 23. The so those operate though those functions are really nice and they're really useful. Um, but they're still a kind of a poor substitute for having this kind of value or error operation. Um because like one so stuff like and that is probably the most common one that I use in our code base. And that's great if what you want to do is I I have this, like I have an expected like T, comma E, um, and then I have a function that takes like an E and returns like an expected U, comma E, and I have another function that like takes a U and returns an expected V, comma E, right?

Barry RevzinLike I'm just chaining these operations together. Um that yeah, so like and there's a lot of cases for which that's true. Like we use and then a lot in our in our code base for our implementation of this. Um, but then there's a lot of other kinds of things where instead of having this like dependent sequence of operations, you have an independent sequence of operations. Um so like uh this is these are actually all the examples that I have in the in the error uh paper. Um for so if I if I call one function that gives me an expected TE, and then I call another function that also gives me an expected TE, and then I do some operation on the two T's, um I could use and then for that, but then that ends up being very awkward because like I'm not really using the result of the first operation to call the second operation.

Barry RevzinI'm just like holding on to it as like a lambda capture. Um and then like somewhere in the inner lambda, I'm now using both both ts. Um so it doesn't it doesn't work very well. And that that pattern is also pretty pretty common. Like I'm just like I need I need five values, they can all fail. Um and then once I get all five of them, then I then I use them to produce a new value, right? And so like nesting that with and then is terrible. Um but if I could not do any nesting, that reads very well.

ConorYeah. Yeah. Check the check the paper for examples because it's uh super motivating. And you said in Kona this was well received, so sounds like if everything goes according to plan, we can get pipeline with placeholder, uh, and we can get the double question mark or some version um of this operator and uh we'll be that much closer. Although Rust doesn't have a pipeline operator. I guess like you said, they don't really need it because of their traits.

Barry RevzinYeah, it would be Yeah, I mean if we if we get both, I think that would be very cool.

ConorYeah. I mean C C plus plus 26 plus whatever next, you know, tier two range adapters that we get in. One uh one range adapter that I'm sad that I didn't put as tier one is scan because I have a list of uh what I'm gonna call like 10 uh problems. Uh currently there's only five of them. And some of them are just beautifully like the before and after, you know, C23 now that we have you know adjacent transform and uh the range adapters there.

ConorIt's they're just uh it's so beautiful. The talks the talks that I have lined up, uh it's gonna be amazing. But scan is one that's missing still that arguably should have been in the tier one category, but it's all right.

Barry RevzinWe'll get it in for you know there's a there's a pretty straightforward solution to that problem, Clark.

ConorWhat's that?

Barry RevzinWell, you you could you could write a paper that specs out what view scan would look like, and then we could talk about it.

ConorThat's true. That's true. Um I've avoid I mean, Britt's Bryce's fault that I have not really written or authored.

BryceI mean, I've you've you know you How is it how what how is this my fault?

ConorThis is your fault because my very first committee meeting that I went to back in 2018 was in Cologne. Uh it was like the July meeting, and I came out of that meeting like super enthused, and I was like, I gotta write all these papers. And you told me no. You said no, Connor, you're not writing any papers. You have to go and figure out the like finished algorithm model. Like you're only halfway through your journey, and like once you finish, and I was like, What? Oh, yeah. I just wanted to like I wanted to write, I think, uh the missing algorithm, a couple missing algorithms from like the talk that I Yeah, well, I didn't want you to do it piecemeal.

BryceI I stand by that.

ConorAnd then so uh I was like, okay, and then like that motivation to write papers has like never returned. Uh and also too, like there's a certain amount of inertia, because there's like three different ways to write papers. And uh, you know, there's no I mean, I mean Michael Park has a blog on how to do it his way, but uh, you know, I see some people they just submit their papers in like a Word document, but like, you know, there's like that initial inertia, like the same thing as like setting up a Ruby Jekyll blog, you know, it's like the the two hours that it takes to go and figure out and install Ruby 2.7 or 3.1 or whatever the heck it is on to like it's super easy once you've done it once.

ConorBut if you've done it zero times, aka writing a paper, you know, it's like uh, you know, what do I don't really know? It's like, you know, obviously for Barry, you've written so many papers, it's like it's like a nothing burger, right? It's like, you know, you go and copy some uh directory and off to the races, change the title, change the date, and you're you're good to go.

Barry RevzinI've a I have a script now to construct a new directory structure for for a new paper, so I guess I've been doing it. Um also exactly you're clearly a better man than me if it if you can set up a blog in two hours, because that is very optimistic.

ConorUh I mean I mean now it it takes like probably less than an hour. But the first time I did it, it might have been a weekend. It might have been uh it might have yeah, I can't remember. Um but it it was like it was it was like pulling teeth, because you know Ruby and Jekyll, it's like not really maintained, so half the things you do, you end up getting errors, and uh then there's some magical command that you put sudo in front of and a couple hyphen options and then finally it works, and then you're like, oh, that wasn't that hard. And every single time I migrate to a new workstation or laptop and I'm setting the same thing up, like Ruby's upgraded and half the things don't work, and it's a whole 40-minute process.

ConorAnyways, we're past the time. Anything you want to mention? Do you have any talks lined up that people can look forward to in 2023 planned or submitted?

Barry RevzinUh I don't have anything lined up. I gave a talk at CPPcon last year, um, but uh it's not posted yet. Um and I'm going to What? Yeah, it's not up yet. In 20 from like September 2022? Uh yeah, yeah.

ConorWhat's what's going on?

Barry RevzinThey're they're dribbling them out. They only post like five a week. Um and there are a lot of talks at that conference. So I'm I'm also going to give that talk again at the Chicago meetup um next week, two weeks from now. Uh two weeks from now. Rob Douglas has finally corraled me into a date. Um, so that's gonna happen again.

ConorPerfect. If you're in Chicago, C will put a link in the show. I assume they're on meetup or something like that.

Barry RevzinUh I think so, yeah. January 31st. January 31st.

ConorAnd uh anything else you want to announce or plug?

Barry RevzinUh no, I got I got nothing to plug, I guess.

ConorAll right. Well, throw your Twitter handle. Or uh are you still on Twitter on Twitter. Are you on Mastodon? Are you have you gotten the lifeboat?

Barry RevzinI am not on Mastodon, I do not understand Mastodon.

BryceYeah, me me neither. Um I it's too complicated for me.

ConorAll right. Well, thank you so much for coming on and uh answering all our questions. Thanks for listening. We hope you enjoyed and have a great day.

Open the transcript file

Hosts and Guests

Guests

  • Barry Revzin Guest Inferred

Credit the people on this episode

Be the first to rate this episode

More episodes

All episodes
  1. Episode 313: C++26 Reflection vs CRTP, AI, Kids & More with Zach Laine

    Nov 20, 202647 minAudio

    In this episode, Conor and Bryce chat with Zach Laine about C++26 Reflection vs CRTP, AI, kids & more. Link to Episode 313 on Website Discuss this episode, leave a comment, or ask a question (on GitHub) Socials ADSP:...

    • Apple Podcasts

    Credit the people on this episode

  2. Episode 312: The C++26 Contracts Fiasco

    Nov 13, 202652 minAudio

    In this episode, Conor and Bryce chat with Zach Laine about the C++26 contracts fiasco. Link to Episode 312 on Website Discuss this episode, leave a comment, or ask a question (on GitHub) Socials ADSP: The Podcast:...

    • Apple Podcasts

    Credit the people on this episode

  3. Episode 311: Career Changes, GPUs & More with Zach Laine

    Nov 6, 202628 minAudio

    In this episode, Conor and Bryce talk with Zach Laine about his career and the career changes he has made. Link to Episode 311 on Website Discuss this episode, leave a comment, or ask a question (on GitHub) Socials...

    • Apple Podcasts

    Credit the people on this episode

  4. Episode 310: Leaving NVIDIA for... ?

    Oct 30, 202624 minAudio

    In this episode, Conor and Bryce talk about Bryce's next chapter and where he is leaving NVIDIA for. Link to Episode 310 on Website Discuss this episode, leave a comment, or ask a question (on GitHub) Socials ADSP: The...

    • Apple Podcasts

    Credit the people on this episode

  5. Episode 309: Default Construction & CppCon 2026 with Jason Turner

    Oct 23, 202629 minAudio

    In this episode, Conor and Ben chat with Jason Turner about default construction in C++. Link to Episode 309 on Website Discuss this episode, leave a comment, or ask a question (on GitHub) Socials ADSP: The Podcast:...

    • Apple Podcasts

    Credit the people on this episode