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 158: The Roc Programming Language with Richard Feldman (Part 2)

Dec 1, 202333 minAudio

In this episode, Conor and Bryce continue their interview with Richard Feldman about the Roc programming language! Link to Episode 158 on Website Discuss this episode, leave a comment, or ask a question (on GitHub) Twitter ADSP: The Podcast Conor Hoekstra Bryce Adelstein Lelbach About the Guest: Richard Feldman is the creator of the Roc programming language, the host of the Software Unscripted podcast, and the author of Elm in Action from Manning Publications. He teaches online courses on Frontend Masters: Introduction to Rust, Introduction to Elm, and Advanced Elm. Outside of programming, he’s a fan of strategy games, heavy metal, powerlifting, and puns! Show Notes Date Recorded: 2023-11-13 Date Released: 2023-12-01 Software Unscripted Podcast The Roc Language Hylo Programming Language Carbon Programming Language Elm Programming Language BQN Programming Language Continuation Monad Continuation Passing Style (CPS) C++ Senders and Receivers Intro Song Info Miss You by Sarah Jansen https://soundcloud.com/sarahjansenmusic Creative Commons - Attribution 3.0 Unported - CC BY 3.0 Free Download / Stream: http://bit.ly/l-miss-you Music promoted by Audio Library https://youtu.be/iYYxnasvfx8

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.

Richard FeldmanI did set out to like, you know, this is this was has always been a serious language. The the intention was always for it to be used in industry. And even if it's only been a little bit so far, it's really encouraging to see it like cross that milestone for real and be like, yeah, we we did actually check that box. And and knowing like how how rare it is that a language that sets out to do that even actually makes it to that point.

ConorWelcome to ADSP the podcast episode 158, recorded on November 13th, 2023. My name is Connor. Today with my co-host Bryce, we continue part three of our four-part conversation with Richard Gillman, the creator of the Rock Programming Language, and we chat about what the status of the rock programming language is, where it's being used in production, and more. Speaking of which, what is the what is the you know uh the state of the art of rock programming right now? I I know that from listening to your podcast that there are folks out there using it for personal projects and stuff.

ConorAnd is it a because other languages like Carbon, I don't think has a compiler, it has an interpreter. Hilo, I think, just released their compiler on gobble.org. And what's the other one that's being worked on? Oh yeah, CPP2. I think that has some amount of a transpiler. I don't know if they're calling it a compiler, but the other languages, I'm not sure if rock fits into that space, but they're the languages that we talk about on this podcast from time to time. You know, don't have uh no one's going and building like, you know, applications in them right now. So what it is rock uh, I think rock's a bit further ahead.

ConorYou can tell us.

Richard FeldmanUm so I would say that I mean rock is at the point where people could be building applications with them, um, but I haven't seen anyone really set out and say, hey, I'm gonna do my project in rock. I think part of the reason for that is I've been pretty vocal about discouraging people from doing that. Um because just because I I am very aware of like, you know, how many bugs are in the compiler and like you know how much work we have to do before it's sort of like a stable experience. And I would hate to have someone start on a project before the language is ready and they just get part of the way through and they just get blocked. And it's like, I'm I'm sorry, you know, you gotta wait until we finish this, you know, this part of the project.

Richard FeldmanHaving said that, that is changing. I think at this point it's a reasonable choice to build applications in rock. Um, and we're about to update the website to reflect this, so depending on when this episode goes out, that might be in the past. But uh here in real time, it's it's the plan is to ship that on next week.

ConorI don't know if you how longer uh this episode will either be coming out uh this Friday, which is the so no, it's not coming up because the first episode was Strange Loop, and then our hard left tangent into Hawaii land coming. So that'll be the 17th, and then this one will either be in part one or part two, so it'll be either November 24th or December 1st. We'll we'll be back. Yeah, the the new website. Okay, so past tense.

Richard FeldmanAll right, so as as you all know, the new website uh is uh looks much more like a normal uh programming language website, whereas the previous website, which I guess you can go to like archive.org to see what it looked like, was very like bare bones, no styling. It was like, hey, this is a placeholder until we have a real website because we want the state of the website to reflect the state of the project. Um but yeah, but but that's like I said, that's changing. Um so the yeah, uh you mentioned this a little bit earlier, but um, the company I work for now, Vendor, we've been working on introducing rock to the back end, and that's been sort of my major project is um actually so we now have it where uh this is in production, so we know it works, like it's actually getting user traffic and whatnot.

Richard FeldmanUh and vendor's a billion dollar company, or at least that was their their last valuation, um that their last like fundraising round. Um but uh I I don't know how much uh like what the actual traffic numbers are offhand that like you know in terms of number of users. Um the previous company I worked for, NoRed Inc. Um, had a lot of users, uh, but not that high of a valuation. Um, so like millions of users, but uh anyway, uh regardless, it's getting real user traffic, and uh but it is very small. Like what we've done so far is is a little bit more than a proof of concept.

Richard FeldmanIt's like one step past that. So we haven't really like shipped a big feature in rock yet, for example. Um so one of the things that I did was based on my experiences introducing new programming languages, which granted is pretty limited, but I I have done it at a couple of different companies. Um I have seen it go a lot better if you can have a really small level of granularity of introducing the new language, ideally at the function level. Uh for example, not at the service level, not saying like, okay, we'll have to spit up a new service in this new language. It's way better if you can just, as we now have the ability to do at vendor, um take this Node.js uh TypeScript backend and just import a rock module and just call a function from it, and it just works, uh, which it does now.

Richard FeldmanUm and we also open source the the way that we're doing that. It's uh rock-ES build, if you're curious about that. Um so you can use that in your project too if you're using ES build, or even if you're not, like the the bones are there to be able to use it in other systems as well. Um and also I had to do a separate thing for Jest, and there's an example in the repo of how to do that for the Jest test runner if that's the test run you're using. Um but basically uh that is as far as I know the only example of rock being like used at production at a company. Um if somebody else is using rock in production, let me know.

Richard FeldmanI'd be I'd be very curious to hear about it. Uh but just thinking back to like I was kind of around in the early days of Elm, uh like 2014, like you know, almost 10 years ago now. Um and I remember back when there was kind of similarly, there was one company using Elm for one thing in production, uh, which was Circuit Hub, and they were using it for some little like widgets they had as as part of their UI. And then you know another company started using it, and people started doing side projects and this and that, and it kind of grew from there. So I kind of think of Rocket being a a at a pretty similar stage where vendor is definitely the early adopters of uh of you know using Rock in production.

Richard FeldmanUm that sounds interesting, by the way, we're hiring. Uh but basically um there aren't any other companies that I know of that have actually started you know building something substantial on it, and all of the applications that I know of that people have done side projects in have all just been kind of like pretty small and like for fun. Um I would say the coolest one that I know of that somebody actually like you know shipped. Um somebody built a mechanical clock uh that used servos to change uh sort of like little fake LCDs, like you know, L C D clocks where you have like the like the horizontal and vertical bars, usually like green or amber or something.

Richard FeldmanUm so he made one of those, but the bars are actually like made out of wood or something, and there's little servos that rotate them to change like what time it is. And he did the he programmed the servos in rock um on the like Raspberry Pi or something. Um so that's cool, but that's obviously not the same thing as like it being a battle-tested language, which it very much is not yet.

ConorStill, I mean that's it sounds like you're way, way further ahead than um some of the other what do we call them, successor. I guess rock is not is not aimed at being a C ⁇ successor, but of the of the languages that we chat about, they typically all are C you know successor initiative projects. But a lot, like as I mentioned before, a lot of them um are still very early days. Like even carbon, I think they have explicitly said like their roadmap is like half a decade or something before they they they're taking it very slow and experimenting and making sure that you know they're mapping things out in a certain way that they'll have really good backwards compatibility with with C ⁇ , which is fair enough.

ConorYou know, you can uh you can attack designing language at whichever speed or or you know design plan you want. Uh but it sounds like rock is way further ahead because your company's actually, you know, you're you're transitioning the the back end, it sounds like, to be entirely in rock or at least to a certain extent in rock. And uh that's like you have to be at uh at least a pretty good stage in order to be able to successfully do that, right?

Richard FeldmanYeah, and I mean we're expecting there's gonna be bumps on the road and stuff like that. It's not like we're gonna be like, all right, everybody, drop what you're doing and rewrite in rock. It's it's more like you know, the the next milestone in my mind is let's ship a new substantial feature in rock. Because so far all we've done is just kind of been like, okay, let's let's try rewriting this little tiny chunk of logic that's you know somewhere in production into rock and see if it holds up under traffic and like you know, doesn't do anything weird or surprising, um, which it hasn't. So great. You know, milestone passed. Um another milestone was people other than me uh writing rock code at the company, because of course at first it was kind of all me just you know setting things up and whatnot.

Richard FeldmanUh also past that milestone. There have been two other people who have worked on the production code base um writing rock. Um but basically like you know, the shipping a substantial feature is obviously like you know uh more work and also sort of like a greater level of risk of running into some sort of showstopper that was unanticipated. I mean, like a funny example was I was uh talking to one person who was working on the little rock thing at work, and he was like, oh, you know, what's the story around parsing ISO 8601 date timestrings? And I was like, doesn't exist yet. But actually, I wrote the library to do that in Elm, so I know how to do that.

Richard FeldmanSo let me go like, you know, throw one together. Um, because they're not particularly complicated format to parse. Um but but at the end of the day, there's there's gonna be stuff like that where we just you know sit down to try to solve a problem in rock and it's like, oh, where's this off-the-shelf thing? It's like, well, the shelf is very small right now, so you know, uh plus on top of that, there's potentially like you know, compiler bugs and things like that to contend with, um, which you know are just gonna be part of the experience of using a bleeding edge language.

ConorYou said so your next is milestone or one of your next milestones is gonna be shipping some new feature. Do you have a list of features that you are gonna be you know trying to choose from, or is that uh down the road?

Richard FeldmanAaron Powell We have a list of contenders, um, and they basically have to do with um like the whether or not they seem suitable. A lot of it has to do with sort of trade-offs around how much is it gonna hurt us that we don't have any kind of developed third-party ecosystem yet? Like in other words, how much of this is just gonna be like handwritten from scratch regardless? Um, and also other considerations are like how big of a project is this? Because again, like you know, the bigger the project, the greater the downside potential if you do get blocked for whatever reason, part way through it, and then be like, okay, well, we need to ship this, so you know how how long is it gonna take to remove the blocker?

Richard FeldmanIf it's fast or there's a workaround, that's fine. If not, maybe we have to go back and rewrite, and then the more you have to go back and rewrite, the bigger the deal that is. So we have a list of contenders, but we haven't picked one yet. Um, those discussions are sort of like in progress right now. Um, but uh it is definitely very exciting to me that like I mean, I was thinking about this at some point, and I was like, what is the set of what percentage of programming languages can ever say somebody other than the person who created it got paid to use it at work? Like multiple people um who who they never knew before they took that job.

Richard FeldmanLike I think it's a very, very small single-digit percentage. Yeah, might be less than one percent.

ConorOh, yeah, if I was I thought you were talking about total number, and I was like, oh, it's gotta be more than double digit, but percentage, it's percentage, yeah, yeah. Like yeah, one percent. Oh, certainly, yeah.

Richard FeldmanThere's like lots of languages have done it, but but way, way, way more languages never make it to that point. Um especially if you're counting like all the, you know, I just made a little language for fun in a weekend, you know, type of projects.

ConorI discovered two languages called seriously and actually. Uh what?

Richard FeldmanYeah. Yeah, I mean this like and like there's absolutely nothing wrong with that. Like it's it's cool to make languages just for fun. Um but but you know, I did set out to like, you know, this is this was has always been a serious language. The intention was always for it to be used in industry. And even if it's only been a little bit so far, it's really encouraging to see it like cross that milestone for real and be like, yeah, we we did actually check that box. Um and and knowing like how how rare it is that a language that sets out to do that even um actually makes it to that point.

ConorDo you uh I discovered that because uh one of my favorite languages is a language called BQN, which is like a next gen APL, and it's not currently recognized on GitHub as a language, but it's like they have some criteria that some third party site does, and there you have to cross some like 2,000 two 200 repos. They're very close to that. Are you have you passed that threshold or are you getting there as well?

Richard FeldmanUh yeah, we uh we we asked the same question. So in order to get.roc to have syntax highlighting on GitHub, um, we have to have more than 200 repositories that are using the language, which we do not yet. Um I don't actually have any idea what the count is, but we kind of like did a search at some point and um it was like okay, we're we're definitely not like right on the cusp or anything either. Um honestly, like most of the repos right now are just like people doing advent of code and stuff. Uh and there will be more and more library stuff. Like we now have a uh working but not completely fully featured um like Postgres adapter that um shout out to August, he wrote that uh in like pure rock.

Richard FeldmanSo he did like the binary decoding of like Postgres's format in rock, which is really awesome. Um and he also did a GraphQL one. Um Luke Boswell has done like JSON and uh has started working on the um uh Unicode stuff. Uh so there's there's a lot of like opportunities for people. Oh, um Arthur started on uh Regex. Um so there's a lot of like you know package stuff that can come up. Um and then also just you know if people want to open source their uh you know language projects, uh like their their applications, then you know that's cool too.

Richard FeldmanBut yeah, I I'm I'm not really uh in a big rush to like you know get to 200 repos so we can get the syntax highlighting to be. It's more important that people are enjoying the language and like finding it useful.

ConorYeah, I think that'll that'll just happen with time. Uh I was more curious uh just because I mean it is nice when you're on GitHub. And I think it's also kind of like a stamp of approval talking about you know the you know success or uh how many people get paid, etc.

Richard FeldmanUm I mean it's it's uh it's definitely also a milestone, but it's it's not one that I'd want to sort of game. You know, I wouldn't want to be like, oh, let's let's everybody go make five repos, you know, that that use like rock so we could get there as soon as possible. I'm just like, yeah, you know, it'll happen when it happens.

ConorYeah. I know that our uh we're getting close to time, and I'm not sure if you have a hard stop, but uh maybe in the last um few minutes here, um we have I mean we've talked kind of a little bit of the language features. I mean, we've mentioned a bunch of things which I think uh implicitly rock has, you know, the pattern matching, uh ADTs, etc. But maybe uh if you want to give us like a high-level overview of some of maybe the other language features, like and also too, like ecosystem stuff, if you know, coming from C, we don't really have a standard package package manager, and I think that's a a huge shame.

ConorBut like also like, you know, uh to what extent does Rock support metaprogramming? Because that I think that is like across functional languages. Uh there are very different stories for you know compile time stuff, whether it's a you know, they don't support it at all or they support it through, you know, Lisp's macros, etc. etc. Um, so yeah, like of the stuff that we haven't really mentioned that might pique our listeners' curiosity, um feel free to you know rattle through things, language or library or ecosystem that apply to uh to rock.

Richard FeldmanYeah, so I mean a couple of things. Um so uh rock is a pure functional language, so that means there is no mutation, there's no side effects. Uh I guess since this is I guess an audience that's familiar with C, I can kind of talk about what the representation is, or uh I should say the representation is going to be, because we are we have not converted over to this yet, but this is what it's gonna be and what it's gonna be indefinitely, so I'll just talk about it in those terms. Basically, so the way that IO works is essentially that let's say I want to do a uh I want to read something from a file, and then I'm gonna do some stuff with it, and I want to write something back to another file.

Richard FeldmanSo the way that that works in rock is what you have is uh we call it a task, and this is basically gonna be a struct that has some sort of actually I guess well it's it's really uh gonna be a tag union. So uh let's let's say it's a union um in C terms, and you have a discriminant that says like here's the I.O. operation that I want to do. So it could be uh file read or file write. Then it's got also inside of it all the information necessary to be passed to that syscall or whatever the I.O. operation is. So in the case of read, that would be maybe um this would be let's let's assume that we're not doing like open and read.

Richard FeldmanUh let's assume that we're just like giving the file path. But of course you could have a separate, you know, open and get the file descriptor if you wanted to. Um that's well, that gets into platforms and applications, which I guess I'll I'll have to talk about next. But um so you have the operation that you want, and you have all the information necessary to perform that operation. And then the last thing that you have is essentially a callback that says like once the operation's done, I want you to call this function, and that function is gonna run and give you back another one of these union things that says like here's the next I.O. thing that I want to do. And so essentially, now we have syntax trigger that makes this look a lot more like uh a lot more imperative, I suppose, um, in the sense of like, you know, okay, first do this file read, I get this thing back, now that's in scope, I can I can do whatever I want with that.

Richard FeldmanKind of like Haskell's do notation, looks looks similar to that. Um and then once I've done the stuff that I want it to do, then I'm gonna call this file write, and then you know, maybe I do some more stuff after that. Uh but essentially what's happening is that that data structure is you know, is what allows us to be pure purely functional. Um like anytime you're doing I.O. you're not actually running the I/O right away. Rather, you're building up this sort of series of here's the I.O. operation that I want, and then here's a callback function that is also pure that's going to return another one of these things.

Richard FeldmanAnd then once you've built up your program sort of describes a big chain of these things, at the end of the day, there's essentially a runtime interpreter that goes through and steps through all these things. Now, what's cool about that is that um A, you get all the nice properties of pure functions. So if you call these functions that return tasks a bajillion times, they still just return the same thing. They don't like run the I.O. operation a gajillion times, which is really nice for caching and replayability and all these various things. Um but also it means that if I want to do asynchronous, for example, you're perfectly set up for that because you're you just call the thing, uh you run the I.O.

Richard Feldmanoperation, and then uh you don't call the callback until whatever asynchronous thing you were doing is done. And so you can interleave these however you want. Um the structure uh is capable of describing like I want to run this one and then that one, or I want to run these two in parallel. Uh I say it present tense, like we've implemented that part yet, which we haven't, but uh it is capable of describing like I want you to run this thing and then also this other thing uh concurrently, and then I only want you to run you know both of their callbacks after they've both finished in whatever order they happen to finish in.

Richard FeldmanUm so there's a lot of really nice properties to doing that, even if you're not trying to be a pure functional programming language. Another advantage to this is so in a lot of languages where you have an async capability like that, you have this split ecosystem where you have the synchronous version of the I.O. operation, then you also have the async version. And if you mix and match those, you tend to have a bad time. Um in rock, I mean, one of the uh sort of weird benefits of having the constraint of being a pure functional language is that you cannot possibly have the synchronous version.

Richard FeldmanIt's not even describable in the language. So everything is async, which means you don't have the split. Everybody's always using async everything all the time. Um, and that's the only way to do I/O in the language. I guess I should pause there before talking about platforms and applications, but um, I guess that gives you a sense of like what the language is sort of about. Um so we do have like uh tail recursion elimination um and also modulo cons for those who know what that means. And basically that means that uh if you want to get the compiled output to be essentially a loop, you just write a tail recursive function and it will compile to a loop.

Richard FeldmanWhich means you can actually have an infinite loop in rock. Um if you write a recursive function. And we actually do, like Rust, we do detect a couple of basic cases of like if every call results in recursion, I think. Actually, I forget if we finish that. That might not actually be implemented yet. I I know Rust has this, and we either do already or plan to have. There's some basic things you can detect where it's like, you know, we can't solve the halting problem, but you can at least detect some obvious, like, hey, there's no there's no base case here, so like it's clearly never gonna terminate.

Richard FeldmanBut at any rate, um so using the language feels very expression-oriented because that's kind of all you can do. Um we do actually have a couple of statements like uh debug is like just right now, just like write, you know, write something out to the like the standard out just for debugging purposes. That's a statement, and then the other one we have is expect, which is uh kind of like an assertion, but um, it's like debug assert in Rust, where basically it's it's like an assertion except that it doesn't halt the program. It's just like if if it fails, it'll tell you about the failure just for your own like informational purposes.

Richard FeldmanAnd then in an optimized build, it just gets thrown away. So this is kind of a way to help yourself out with testing. Oh yeah, and also if an expect fails during a test, then the test fails. So this is a way to sort of uh sprinkle throughout your program little things that you expect to be true, like sort of encoding assumptions in your uh in your code, even if you're like, but not so much that I actually want you know a runtime crash if we get here. I I I just want to know about it, but I don't want it to like stop the program. So yeah, let me stop there before I get into platforms and applications, which is sort of like the big idea in rock, I guess, and and the thing that's most unique about it, uh it's language feature set.

Richard FeldmanUm and I don't know. Uh see what you what you think or if you have any questions.

ConorI mean, my one question, uh and we'll see if Rice ha has any Is there a name for that uh like task chaining IO? Like, did you is that like a novel thing that you know the rock people and you came up with? Or is was that like uh an idea borrowed from an academic paper that has some esoteric name, or maybe it's a popular thing and uh you were just describing it that I haven't heard of?

Richard FeldmanThe academic esoteric name is the continuation monad. Uh I did not come up with it. Um William Brandon, shout out to William. He he told us about this. Um I didn't actually realize that that was uh something you could do in a language that has the type system that ROC has. Um but it turns out you can, and it has a re a bunch of really nice properties. Uh we're only kind of scratching the surface of like what we want to do with it. There's like a whole bunch of stuff planned that I would be very excited if in the next year we got those things implemented.

Richard FeldmanUm, but I don't know if we will because there's it's it's it's a substantial list of like of really cool things um that we want to do with this. But uh I mean the the the upshot of it uh that I I'm most excited about it is that from a user perspective, it feels really simple. It feels like using like promises or like futures or something like that, like or like async await. Like you're you're just like, okay, I have this thing, I want to await it. Um and then all right, then I keep going with my life. Uh there's no split between like, oh, this thing is async and this other thing is synchronous.

Richard FeldmanIt's just like if you're doing I.O. it's always asynchronous. Um and then all of the nice properties that come with it are are really mostly either behind the scenes or they enable a feature where it's like, oh, cool, I I have this new thing that I can choose to use for testing or or this or that um that I don't have access to in other languages.

ConorSo is this the same thing as CPS, continuation passing style?

Richard FeldmanUh it's not well, I guess it's a form of it. Um I mean so the continuation passing part would be inside that data structure. I mean, there is a continuation, right? That's like I mean, I I use the term callback, but that's basically the idea. It's like, you know, you you run this IO operation, then afterwards it's like, here's the thing that I want to do next. Um that's the continuation, right? It's like that's what we're gonna, that's what we're gonna do after we've done, you know, whatever the uh the I.O. operation is. So you can think of that as like, well, we've suspended execution, or you can think of it as like, well, really what we have is we have a continuation that's like, here's here's where the rest of the program comes from.

Richard FeldmanUm and we're not gonna call that continuation until after we've finished the uh the uh I.O. operation in question.

ConorI mean, this is interesting because I've never implemented a continuation monad, but you know, I've read stuff about it, and I mean Bryce can correct me if I'm wrong, but isn't senders and receivers just the continuation monad?

BryceYes.

ConorSo that's like uh a new asynchronous algorithm, I don't know what uh what do you call it? A framework, Bryce, that we're has been proposed.

BryceSure, framework.

ConorHas it been accepted for C26 or not yet?

BryceIt's been design approved.

ConorI don't even I don't know what that I don't what I don't know what that is committee speak for, but uh let's let's not worry about I don't think we need to not uh it yes, it's on track, but uh anyway, potentially a new uh newer C near you uh C near you in the future. They've also implemented a or or approved a uh language feature slash framework, which is essentially uh I don't think actually anywhere in the paper that is proposed it.

BryceBut hang on, but but I I think that C coroutines are m much more similar to the async and rock than uh sender. I mean, and there is some degree of uh in uh what we call what's an awaitable in in uh a coroutine awaitable essentially can be a um a sender too. But I think that this is much more similar to the like the classic async await pattern which we also have in in C.

Richard FeldmanYeah, I think what it's what it most closely resembles is you sort of the the popular async await way that thing you know languages do that today.

ConorRight. Which, I mean to my understanding, in C we would be able to re-implement coroutines on top of senders and receivers, aka the continuation monad, once we have it. Um re-implement coroutines on top of the like I thought coroutines is basically just like a specialization of or like an implementation of the continuation monad uh to do your async await stuff. Like continuation monad is like the most general pattern, but like you can you see it everywhere, right?

ConorLike there's a bunch of different, I don't know if you call them specializations or applications.

BryceIt is definitely so so um senders allows you to express asynchrony that is that is linear chained and not strictly continuation passing style. Um and it allows you to pr to express continuation passing style asynchrony. So so you you you understand the distinction between those two there, Connor? I think so.

ConorBut I I feel like this is kind of like now I've I've treaded into academic waters that uh you know No, it's uh it's actually it's actually fairly important and relevant to our platform.

BryceIt's and it's a question of when are you going to know what the task is that you're going to enqueue in a in like a C coroutines world where you've got like a function that coawaits um it's like got three different three statements, each one co-waits on a separate call to something. Um you know, after that first co-wait, the coroutine yields back and then you've got this function that you can call to resume the coroutine.

BryceAnd um you have no way to look ahead and to know that, oh, you know, the next cowait's going to co wait on this expression, and then the next co-wait's gonna co-wait on this other thing. Whereas in the sender's framework, you would express that as you'd build a pipe where you'd say, like, then first thing I'm gonna call, then second thing I'm gonna call, then third thing I'm gonna call. And then you know at the time of that task graph creation, you know and can see all three of those calls.

BryceAnd so you know exactly what's gonna happen. Now, in in in the C world, the compiler under the hood, it obviously has to figure out what this coroutine looks like and um uh and uh it it has to know these things. Um but uh the interface that the that that uh C ⁇ coroutine exposes to you, the user, and to you, the implementer of an of a uh uh scheduler or an execution context, all you get from a coroutine is just, hey, here's a thing that you call that will resume the thing.

BryceYou don't get any other information about the task graph, which is very annoying for some.

ConorYeah, if you're trying to schedule stuff efficiently. All right, how does that map back? Did that did you track all of that, Richard?

Richard FeldmanWell, having having I mean uh having personally used zero of those C features, I didn't track great.

ConorI mean, in all fairness, one of them doesn't exist yet, and uh the other one has zero library support for it, so there's only a handful of things. All right, well, I don't feel too bad.

BryceWell, so so so I guess another another way to think about it is um in the traditional continuation passing uh like style, like if I want to chain like three pieces of work, like piece of work A is going to run to completion, and then it's going to launch piece of work B that'll run to completion, and that's gonna launch piece of work C. Yeah. Right? Totally. So um the the challenge with that continuation pass and style approach, especially in this day and age, is that you might be running on an execution environment where you either cannot or it would be slow to enqueue the next piece of work.

BryceSo, like for example, a GPU. Um on NVIDIA GPUs, we can do what's called nested parallelism or dynamic parallelism, where you can have one kernel launch another kernel and launch another kernel, um, which for has been supported on NVIDIA GPUs but has been slow for a long time. We've recently released a new version of it, which is a little bit faster. Um, but there are also some accelerators where the uh accelerator can't actually launch the next piece of work itself.

BryceUm and uh it's not always the case that you can gracefully and transparently uh like transition back to the place that can launch the work, especially if the continuation is wrapping a bunch of enclosed state from wherever you were executing. And so the the the the thing that C sender's model gives us that um uh we don't necessarily have encuroutines is a way to to to express a uh a graph of asynchronous tasks where we don't have to rely upon continuation pass and style um or the control flow um or the the the um what's the word I'm looking for?

BryceUm like execution control does not have to be done in place. Execution control can be done a priori or can be prescribed um or can be like left up entirely to whatever backend you choose to target. And like like this this problem I think is is to me the the one major downside of async await in almost all the languages that I've seen it in. Um where it it uh it relies almost entirely on the continuation pass and style model, which makes it a bad fit for execution uh environments uh that uh uh do not uh uh support or do not efficiently support running the next piece of work directly from that execution environment.

ConorAaron Powell Be sure to check these show notes either in your podcast app or at adspthepodcast.com for links to anything we mentioned in today's episode, as well as a link to a GitHub discussion where you can leave comments, thoughts, and questions. Thanks for listening. We hope you enjoyed and have a great day.

BryceLow quality, high quality, that is the tagline of our podcast.

ConorThat's not the tagline. Our tagline is chaos with sprinkles of information.

Open the transcript file

Hosts and Guests

Guests

  • Richard Feldman 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