I'll say this. You are not the oldest guest we've had on the podcast.
Patrice RoyYeah, you're very sweet. I just turned 50 like a few weeks back.
BryceYeah, then not not even you're not even in like the top two or three.
ConorWelcome to ADSP the podcast, episode 74, recorded on April 14th, 2022. My name is Connor, and today with my co-host Bryce, we interview Patrice Roy about C education, cats, and more.
BryceYou know, it's interesting. I I um I was thinking about this a bit the other day that um I that they're thinking about the nature of programming books. Um that I think, and maybe maybe this is untrue, but I'll I'll put out my theory here, which is um I know a lot of people who write programming books. I have a shelf full of books that are written by my friends. Um but my impression is that most of them are written with the audience of post-education um people, people that have graduated from college, that are practicing, you know, software engineers or programmers and who want to continue learning their skills. Um uh and that they're not written as textbooks. And I guess my impression is that like in other fields, um that tends to be less the case. It tends to be more that books get written as, you know, explicitly as textbooks or as course books. Maybe I'm wrong about that. Maybe my perception is is is off here. I certainly know that some of the C books that I'm familiar with are used as course textbooks. Um, maybe not at like the, you know, the introductory level, um, but but at the higher levels. Um but I think it is sort of like an interesting phenomenon. Um, it reminds me of a of another thing, which is when I was a kid, I would go to conferences all the time with my mother because she's a lawyer, and lawyers um have to do a certain amount of continuing education um every year to keep up with their certifications, their, you know, their uh Bar Association memberships in the US. Um, and you know, one of the ways that you can qualify to do that for that continuing education is to go to a conference and you know attend some classes there, which is a lot more fun than just like taking some training courses. So, of course, that's what we would do. Um, but there's no real certification or requirement for that in you know the programming industry. So it's sort of um up to our own, to each of us to feel motivated to continue learning.
Patrice RoyYeah, but if you don't, you're gonna get stuck way, way back and you're gonna stop following what's going on in the world. And the um I don't use books uh written, but I have probably the same books you have. Uh I don't use most of them in my classes. I do suggest chapters from time to time to students. I write my own material. If you look for introductory books, there's one uh from Bjarne that's kind of cool. They the one, the the one with the the birds on it. Yeah, tour of C. No, this is this is cool if you already know how to program, but the programming principles book with the swans on it. It's written for undergrads, so it's kind of accessible. And what I like about it is that it goes into detail as to why you do that, how you can do things with the language, what what the purpose is, what the uh there are pictures of people like Stepanov and they're like these are the artisans, the people that have worked on this. The language lives through them. So there's I think for beginners it's an interesting book. It's a bit big maybe for a class, but uh but I don't use it.
BryceSo the one the one that Patrice, there's a there's a few different books by Bjarna. Um uh two of the more mainstream and popular ones are uh the Swan book one, which is uh programming principles and practices using C by Bjarna. The other one, which um is one that I is perhaps the most frequently cited introductory C book that I know of is the C programming language book, which is um has a similar cover in that both covers are blue, but the C programming language book has mountains on it. Um I don't remember, I don't know if there's a fifth edition of it now. The fourth edition was I think the C11.
Patrice RoyNo, yeah, Bjorn he doesn't want to write one because the language has changed too much. And I don't think it's a good introductory book if you've never programmed before, though. It's it's a good book to get C if you learn something else in the past.
BryceYeah, interesting. I've I've I I know some people wrestlers that have used it for a for an intro programming course that was taught in C. Um, that there's some other books that Bjorn have written, written, like uh the design and evolution of uh C, which uh that's an awesome book, though.
Patrice RoyThat's really, really, really good. Yeah.
BryceYeah, it's uh I I've I've recently was diving in it to find quotes for for something. It is a pretty solid, pretty solid book.
Patrice RoyIt gives you perspective as to why things are the way they are, uh, why why the model is what it is, and how it differs from other languages. So even if you don't like C, you should read that book to at least get why the language is what it is, because there's purpose to that, there's meaning to that. It's uh the i i i passed it along to my colleagues, and everybody loved it. Even those who don't do C, they love the book.
BryceSo you said you you develop your own course material. Um, is that is that pretty common in the CS world?
Patrice RoyWell, I I don't know about the CS world entirely. Uh uh in where I work, uh many of us do that. So uh it's yeah, yeah, I'm a bit of a maniac for that. So I write my own stuff all the time.
BryceNow, now, of course, I'm gonna put you on the spot. Is it open source?
Patrice RoyUh well, uh if you can read French, a lot of it is on my website. I have a very big website with awful colors, I know, but that's some purpose. It's it's an ugly looking site with lots of contents that uh people who speak French look at quite a bit. Um uh I used to have um a password on the site, but it was a hassle because uh people couldn't reach it through Google. So I removed that. The course material uh that's in book format is accessible, but universities they want to control access a bit, so they're on Moodle sites, so it's not as open source as it could be. Uh, if I do a big update of everything at some point, now I don't have the time these days, uh I might like just publish the stuff uh in article form on my site to make it available to more people. So right now there's an overlap between the book kind of stuff that I write that's for the students and the article stuff that I write that's on my site. And some in some cases the site is more up to date, in some cases the books are more up to date. But the overall stuff is pretty good, I think.
BryceIt it just seems to me like, you know, we we in the um in the soft world world, you know, we we know how to do you know open collaboration between you know different, you know, spanning organizations and and national boundaries and you know, uh and everything. Um it seems like, you know, what why why isn't why doesn't like every programming language or every field in CS have like some you know open source collaborative effort to develop uh uh you know educational material for the university level?
Patrice RoyThat's a very good question. I don't know. There are open classes. Uh the maybe it's just because schools make money out of that. I don't know. It can't be that simple. No, the why do we sell the standard on ISO? It's because yeah, there's some slight amount of money to be made out of it, I guess. Um the uh I want I want people in my classrooms. I want to be with people and talk to them. So I don't want to record my classes and let people watch them uh from home using popcorn and beer. I'd prefer them to be having popcorn beer with me or something. So so if I publish everything online, uh I'm gonna be alone in the classroom, it's gonna be boring. Um I have that, yeah.
BryceDo you uh so do you teach all your classes in French?
Patrice RoyNo, no, no, no. I do. I do give well the CP North class would be in English, of course.
BryceSo the those are I'm in the university classes.
Patrice RoyYeah, yeah. I I did sometimes I give um when we have um students from outside of Canada uh quite a bit, sometimes they do give bits in English. I answer English questions in English to help people on, but people come to study with our class uh in our classrooms, they do have to learn French or speak French. There's a video game uh graduate class that we begin, we've been offering for 17 years now. Uh it's a full-time uh graduate degree for people who want to come in and uh participate in game development. In this class, there's a lot of French from France students, but there's also Spanish people, there's people from the uh Eastern uh from Eastern Europe, from South America, from the English-speaking world too. And uh but the classes are in French. So I leave them as much as I can when they're stuck, but otherwise, well, they're learning and they're doing well. Anyway, they want to work in Montreal, so learning French is a plus.
BryceYeah, it's important, yeah. So are there any are there any challenges to teaching um uh something like C in French? C, you know, the the the language, you know, and the constructs of the language are obviously sort of uh very English centric in nature. Are there any you know challenges that come out of that?
Patrice RoyYou want the funny ones? Yes, definitely. So something like length, the T and D H, they're so hard to write for French speaking people, they keep mixing them up. But no, no, it's not that difficult, really. It's not the uh most uh most people here in Montreal, they speak they speak both languages. So so they they they kind of have the basics of English at least. Uh coming from France, those who come from France they do have some basics in English too, so they kind of get along. Uh if you ask them to write a paper for you, it might be unpleasant to read because the syntax would be all wrong, but you know, it's not nothing that difficult. The the most difficult thing is getting people to structure their thought, and that's regardless of language. So um the writing smaller functions, more focused classes, uh, stop using pointers all over the place when you don't need them, things like that. And that has nothing to do with English or French.
BryceInteresting. Yeah. You know, it's it's it's interesting to think about, you know, people programming um uh in languages other than English, because I I'm not really aware of any programming languages where the constructs are not um uh or the keywords are not sort of very English centric. Um there are some there are some called network equal in French.
Patrice RoyIt's very very strange when you look at it, though I've seen that there's APL, it was more math-oriented. There's weird things, yeah. There's weird things like white space where you know everything at your right, that's not a white space is a comment.
BryceYeah, but are there any languages where the keywords are um not English keywords?
Patrice RoyAs I said, I know I know Windev that does that. Uh I sometimes have uh people having internships and places where they use that, but it's kind of I'd say it's understandable do you think of it because you want to reach the wider audience and it's the labor from these days. So if you C sharp, the guy who wrote that is Danish, but it's an English language, and Bjarne is uh from the Scandinavian countries too, but it's you know your audience is English.
BryceYeah. And for a long time in a language like C, um, you couldn't have non-ASCII identifiers or even, you know, there were there were some compilers that would reject comments if they were not ASCII.
Patrice RoyAnd if I may, I have so much respect for the SG16 people who are working on Unicode for C. My uh tip to them, they are heroes.
ConorYeah, when is C gonna get Unicode? I need to be able to write my APL compiler and C. And I tell you, I tell you, trying to trying to like iterate over a string that does not contain UTF-8 or the 256.
BryceIt is uh You should you should try Zach Lane's um text library, which I think is part of boost now.
ConorOkay, I'll look into it.
BryceYeah. So Kamara, do you do you know of any languages that have non-uh English keywords?
ConorWe I think we asked this question earlier on another podcast and we had a response from someone on Twitter that said, Oh, there is there is actually a language and they link me to it, but I do not have it top of mind. Um I'll I'll I'll throw a language out there that doesn't have non-English keywords, but uh it has a very interesting character set. Um, and it's called Jelly. I'll just leave that for the listener to go explore. Just Google Jelly programming language.
Patrice RoyI I've I've had to use tricks in jobs I've done in the past. So in the recent past, that brought me to pre-C 98. U and you know the toolbox, when you have a full toolbox, it's very, very useful in those moments.
ConorYeah, I can't imagine. I can't imagine. Uh you know, C11, that's what I started with because I started working in C or not not in C. I started working in the year 2014 and we were using C11 at that point. I don't even think the full feature because we had some Visual Studio 2000 something that only had like half of the features. Still, they had the auto keyword and lambdas and stuff like that. And um, yeah, I can't imagine having to go back. And every time you want a callable, you have to build a function object in the form of a struct with a like just there's so many things that like I took for granted when I started with the language, and you'd hear about people being like, oh, you know, you don't know what it was like, and I'd be like, I don't know, it seems like a pretty nice language to me. Um, but then you realize that there were the I wouldn't want to call them the dark ages, but just like the the pre-C11 ages. And so when you mentioned pre-C 98, that's uh I I can't even, yeah, I can't even imagine.
Patrice RoyIt was a lot of fun because it was an 80 and X place where they had to certify the binaries that they were generating. So they had to compile stuff in debug mode to make sure it was the readable binaries, then they certified them and cost so much that they didn't want to change the compilers in any way to make sure that the binaries were as stable as they could. So it were, we were using compilers I had not used in my 23 years of teaching, older stuff than that. So I had to really pick in my old toolbox. If you took a problem like doing function composition f of g of x, and you try to solve that problem with C 98, 11, 14, 17, 20, the the evolution of the way you solve that problem is amazing. It's gotten so simple and so clean and so efficient, and it used to be doable, but in such convoluted ways. Yeah, there's a number of things we have learned over time, and the language is really helping us. So, yeah, we're gonna solve problems in many different manners in that class. And I think it's gonna be awesome.
BryceSo, yeah, Patrice, Patrice, you haven't always been a professor, right? You what what did I think I thought you worked on some pretty cool stuff for your professor? Didn't you do uh uh like flight simulators or something?
Patrice RoyUh yeah, I I I did I did research for Hydro Quebec, which is the biggest uh company in Quebec here. It's uh state-owned thing where we produce electricity. And since we have a lot of water in Quebec, well, we have a lot of electricity. And we after that, I did a few years of uh military flight simulator work, indeed. So, what do you want to know about?
BryceSo, was that was that all was that all in C? Was that in like C in the early C days?
Patrice RoyOkay, so now now you want the stories. Uh when I got there, uh the reason I got into flight simulators at first was that I had gotten a scholarship for graduate studies and I had a baby, and another baby was coming along that was not expected. And I looked at my scholarship and said, Oh, we're gonna have a problem. Money is not gonna be sufficient. So I applied there because a friend told me, Yeah, we're looking for people. I went there and they asked me, Do you want to do military work? And I said, No, I don't. And they still hired me and they offered me a job doing military flight simulators. And I thought about saying no, and then I looked at the money and said, Well, I had no choice. But I really, really enjoyed it. I learned a lot of stuff. It was very instructive. It was a milestone in my uh my personal development. It was a very good learning experience. Now, when I got there, my boss was a Fortran 77 expert. And he was uh, you might not be aware of that, but Fortran 77, you don't have local variables, everything is static. So if you were trying to write recursive functions, you're gonna have a lot of pleasure. Um, he was scared of using the stack for functions because uh there seemed to be in his mind a cost to the stack pointer being incremented and incremented in code. So they're there just selling the fact that we had local variables was was a fight. So it was a mix of forend77 and size and C C that we had to do. Now I I was a C aficionado back then already, with the C I knew, which was much more limited than what I know today. So I had built a framework of macros to make my uh C code behave kind of like C with initialization and stuff, uh, which generated a lot of code because it was um I tried to be as clean as I could. And I actually saw an error message when I was there that claimed that the function had gotten too big through macros and the computer refused to optimize it. I had never seen that before. There are too many lines, and I refuse to optimize your code to go to hell. Kind of sounded like that. So, yeah, so I did that. I worked on uh mostly helicopters uh that went to war, but also uh did search and rescue. I worked on uh communication channels and I worked on a system that simulated uh voice messages within the uh simulated um helicopters. Voice is interesting because it's a real-time system, it's hard real time. Uh the people in the uh helicopter, they have to be able to um tune in to a radio and listen to, believe it or not, the weather. That's very important for them because they don't see what they're doing and they're guided mostly because there's always like fog and stuff. And they want to go to such and such airport and they want to know what the weather is to actually do their approach properly and don't kill themselves or anything. And the uh executive system that we had there, so it was a layered thing with uh see it as a four-level tree. The topmost part was a critical band where things have to be done at every iteration of the system, and that's life-saving stuff. And as you go along down the tree, uh things get more less and less critical, so they might skip turns from time to time. And I happened with that system to have pieces on each and every level of the system, so I got the whole experience. Yeah, and and it was the biggest flight simulator in the world back then. So uh by far. So uh it was seen as a research project, but our motto was at CAE, we can. So we said yes to everything, regardless whether it made sense or not. And and I was given 50 hours to take this bit of Fortran code that worked on a single helicopter and make it work on a system of helicopters that behaved as a unit when sharing a world through many machines, not pure parallel code. It was uh and kind of concurrency and shared memory and stuff, which of course made no sense. It took three hours to do. So it was the three hours, three years, three years to do instead of 50 hours. It was crazy. Um, and if you want the inside story, when I saw this, I said I'm never gonna write that in Fortran 77. Makes no sense to me. It's way too hard. So I asked for a budget to rewrite it in C because C was out of the question, it was too scary. And they said, no, we don't have the money. So I went on my own at night and I wrote the whole thing in C on my own time, and I committed it and told nobody for a few weeks. And when everybody saw that it worked, then I told them, and everyone was relieved because nobody wanted to do that in Fortran anyway.
BryceBut yeah, so that what year was this? When was this?
Patrice RoyUh I I was there between 1995 and 1998.
BryceWow, those were really the the early days of C Foss, and you were already using using it, already familiar with it. Wow.
Patrice RoyYeah, I started using C around 1993 or something. Uh I'm old, sorry.
BryceI'll say this, you are not the oldest guest we've had on the podcast.
Patrice RoyYou're very sweet. I just turned 50 like a few weeks back.
BryceYeah, then then not not even you're not even in like the top two or three oldest guests.
Patrice RoyYou're very sweet. No, I don't to be honest, I would have stayed at CE if I had not gotten a teaching opportunity, but I wasn't to do teaching in the long term. And when I got an offer, I said, well, if I don't do it right now, I might never do it. So let's just do the move. It cost me a lot of money to do that though, because I was well paid at CE.
BryceYeah.
Patrice RoyYeah.
BryceSo how much so many kids do you have now, Patrice? You meant you mentioned two.
ConorI can hear some kittens in the background. I was really hoping we'd get to see one.
Patrice RoyUm no, they're sleeping right now. Most of them, well, I just fed them like 15 minutes ago. So they're most of the 15 minutes.
ConorWho's got someone someone had some cats or something that was going, yeah. And uh yeah, I'll keep that in. I'll keep that in. Everyone's gonna get to hear Connor as a cat. Um I do know you have a lot of pets though, Patrice.
Patrice RoyAnd and there are seven cats at home. There's one dog, three parrots, a hamster. The number of cats has gone up to as high as 30 from what region. Yeah, yeah. But well, we have a shelter.
BryceOkay. I was about to say, like you basically have a farm or a shelter, yeah.
Patrice RoyWell, I have a wife who works at the veterinarians clinic who's an expert in um uh cat and dog nutrition. So she can so she works from home mostly and she uh guides people who have problems. It's a free service. So people just call the the dial in or uh the the schedule meeting with her, and they have an hour and she listens to what the what kind of problem they have, and they she guides them through uh their uh nutritionary needs. We have seven cats of our own, they're all kind of weird, like with weird paws or weird defects, one of them is a missing uh tail, whatever. And we take um in Quebec, most people move around July, but there's a tradition where first of July everyone's moving, and people tend to abandon their cats along uh around that time, which is very sad. When uh we were leaving, uh our previous house was about 15 minutes drive from where I live now, and my wife was uh in the uh was uh in the post administration. She was managing kind of a shelter organization where they rescued cats, sterilized them, vaccinated them, and let get let them go. When they got pregnant cats, it was more complicated because you don't want to sterilize them with the babies then. So we used to take the cats then, uh the uh let them have the babies and then sterilize everyone and vaccinate everyone and find homes for them. So we kept on doing that when we moved. So that's why sometimes we have as high as 30 cats, because uh there was one time two years ago, three years ago, when we had four pregnant uh cat ladies uh in the span of a month, and all of them gave birth to four to six kittens. So they each had their own room such that they didn't fight, and there were seven little birth with seven little boxes to be twice a day. Yeah.
BryceSo so if I understand correctly, then it is likely that you will that right before C North, you will have additional cats that will that will end up in the house because everybody's moving in July and absolutely probable.
Patrice RoyYeah, that's the kind of thing that tends to happen. It's happened less with COVID because people moved less, but yes, we do that. And and then then why do we do that? Because we can. I mean, my wife is good at this. We can uh when they need special um medicational treatment, can she do that? We can prepare milk and feed them when the ladies cannot do that with small uh bible, I don't know what the English word for that is, but no, when you feed babies with bottles, yeah. So we can do that with cats, they're very tiny bottles. And yeah, and and when when when the lady cats cannot do it, because already they kind of make the babies to make them uh pee and stuff. Well, you need to do it yourself. You need to put the baby cats on top of the uh um the sink or the toilet, and you need to message them properly such that the pee and stuff to and then you wash your hands, of course. So I do that quite a lot.
BryceHow how we I've do you put pictures of these cats in your in your talks? You have to start if you don't.
Patrice RoyI I I I've done that once or twice with a few cats, but my my wife has a Facebook account, she she she's more of a picture person than I am. But I haven't done that, I'm not a big picture person, but I have done talks with pictures of cats. But I I feel I I it feels weird to me to to advertise that during my talks, but I do talk about them. And you talked about the kids. I have five. There are only two left at home because theirs are all gone. One of them is going to be a kind of lawyer soon, one of them is a dance instructor, one of them is a uh literature major, and I have a teenager and uh young uh kid who's still in the elementary school. And you teach at two different schools, and I have a PhD, which I did along the way, and I used to be a union worker too, because uh I used to be part of the teachers' union. Well, uh one of the executive members, and I do work, you know.
ConorWhat's the secret, Patrice?
Patrice RoyAsk Bryce who never sleeps. I mean, I do sleep from time to time.
BryceBryce doesn't sleep, so uh no, I had to take that out of my profile signature because now I now I sleep. My my email signature for many years said sleep is for the week, but now I uh now now that I'm an old man, I uh I go to sleep.
Patrice RoyWell, what do I do? Well, when I feel tired, I go to sleep. I can tell you that. And uh since since I I've seen Michael Wong's resume, I don't feel like I work a lot anymore because my Michael is is ridiculously busy. It makes no sense. I don't know how he does it. But uh yeah, I get up early, I go to bed late, and I try to do a proper job. You know, so that's what I do. You know what's what's the most difficult these days? It's uh there's been a uh lowering in literacy skills. So people learning to make meaning out of the text that they read. So in university in college these days, what I noticed for the last two, three years, uh you have to repeat more what you say because people they can read out loud the words, but the phrases don't make the same sense to them as it used to. So the thing I say the most these days is please reread the directives to make sure you've got them right. Please mark down what you've done because you probably didn't get it properly. And sometimes they gave me homework back, and I have to give back saying, that's not why I asked, please do it again. And when when at some point I sit down with them, and I've done that many times in the last few weeks, I read out loud with them the words and said, I never saw that paragraph. It's the first one in the actual text, but they just came over, you don't see it. So my fight these days is make sure they read because there's been a lowering during COVID times of reading skills.
BryceYeah, I was just about to ask, you said you said the last one to two years. Do you think that that's related to the move to online? Yeah.
Patrice RoyYeah, I'm I'm pretty sure there's an impact because it didn't used to be there's always problem with people having problems with their reading skills, but generalized like that, and so that's almost half of the students these days. Interesting.
ConorI used to have to uh at the top of my exams, I would write RTQ, which stood for read the question. And this is not necessarily because I have a low proficiency in in in reading, like I read quite a bit, but uh, especially with math exams, I get very, very excited because I know I like I see the structure of the problem in a few numbers, and I just assume, oh, I know I know what to do here. And then I'll end up, you know, there's times where I failed tests because I didn't actually read what it was asking me to do. And I just sort of very quickly got excited, went ahead and answered, and then I got back and it would say, you know, 40%. And I'd be like, what? What happened? I like I nailed that, and then I would go back and the commentary from the prof or the teacher would be like, this is not what uh you know was requested, you know, please read more carefully.
BryceAnd uh yeah, that's that's sometimes sometimes there's this interesting phenomenon that sometimes people that have a high um reading proficiency um and who can read very quickly um uh uh will have trouble like recognizing uh an error in a text because they read through it so quickly that they like you know they they they just complete their mind, their head just like corrects whatever the error was um in in the sentence.
Patrice RoySorry about that.
BryceYeah.
Patrice RoyIf if you'll allow me, we used to me what me and one of my close colleagues, we used to have this exam we passed to first-year students, uh like midway uh through the semester where there were um objective questions. So you have a choice of answers, and in one of them, the answer was pseudocode. And but we put pseudopod POD instead of code, which is a um tentacle as first answer, and pseudocode was the fourth one, and the only ones that missed it were the good students because they read too quickly. So they saw the first word, and I used to give them uh I used to draw small uh uh squids and hand them over in the class in public saying you got a prize today because you read too quickly. So yeah, you only hit the bad word the good students with that.
ConorYeah, it's funny. My dad would always joke to me, like when I was in high school, and if I did poorly on something, he'd ask me and I'd say, ah, I didn't do that good. But I mean, that's just because I didn't read the question correctly or whatever. And you know, so I I knew what I was doing, I just didn't. And if we went on into university, and like whenever I would talk to him on the phone, uh, he would just like he just heard a chuckle because like is his joke is like, Oh, you didn't read the question, oh surprise, surprise, you know, that uh you did the only reason you did poorly is not because you prepare didn't prepare. It's uh it's because you don't have time to like do the most important thing, which is to figure out what what the test or the class is asking from you.
Patrice RoyWell, at the level where we are, it's reading your messages. I mean, we get professionals, they don't read messages well enough, but they they're often quite talkative, you know. You so you when you read them properly, you kind of grasp the gist of what's missing if you have to work your way through. So making them learn to read their messages is a fight because after two years in school, they still don't do it.
ConorWhat's super, super interesting about that is a lot of the times in a production code base, you'll get some crazy template, you know, template metaprogramming, you know, 100 lines, everyone's seen it. And my gut reaction is like, I don't know what this is doing. And then I'll go to Godbolt, I'll get some minimal, you know, reproducing version of it, and it'll be the same sort of error, but like now, because it's a minimal, you know, reproduce and like I know exactly what's happening, I'll just read it and it'll actually tell me, like in the midst of all the garbage, like the exact problem, which the previous error actually also said. I just, I just like I saw it and my eyes glazed over, and I was like, Oh, I'll go fix this in God bolt. But like it's like you said, a lot of the times the error messages, like in the midst of all the angle brackets, there is actually like very specifically what your issue is. If you had just taken the time to read it, which I rarely do, I just go to God bolt. So there's something there that, like, you know, we we always complain about how awful they are, but like a lot of the times in the midst of that awfulness is actually like the key to the problem.
Patrice RoyUm, we just don't think you're making a point for writing smaller functions and smaller meta functions. And if you write small things, it's so much easier to find your way around. You almost don't debug if you don't do that.
ConorYeah, yeah, that's true.
BryceWell, one thing that I I I've run into that a lot too, Connor. And I do the same thing where if it's can if it's looks like it's gonna be hard, I'll just go to Godball to try to reproduce it there, especially a lot of the bugs, because I'm mostly working compilers these days, a lot of the problems that I run into are um bugs that are actually in the compiler. And so if it's a compiler bug, if I think it's a compiler bug, my first reaction of is to reduce it down to um, you know, the form that a compiler writer wants it in, which is, you know, pure like ideally pre-processed source code that's like minimized, that has no includes or anything, so that it's you know, an easy test input to reproduce. Um, but one thing that I've uh often done with uh more complex template errors is I'll dump the error message to a text file. Um, and then that lets me go and do some reformatting of it. Um if it's an if it's an error message where it's it's complaining about like, you know, the second argument, the second template argument in like a template that has like four or five arguments, and like maybe one of them's like, you know, just a string of like nonsense. Um, you know, the the default way that most compellers format that um is just to give it to you all as one long line. And so oftentimes if I take it into a text editor and I if I just like start manipulating it, like put each argument on one line, then it becomes a lot easier for me to figure out oh, this is actually what the problem was.
Patrice RoyYeah, you're making a point for indentation of code too, is the same thing.
BryceYeah, yeah, exactly, exactly. On the other hand, some of some of the other compilers I work with, um, they try to do that sort of formatting for you um uh in their error messages. And it's like it's it's the it's hard to identify what the optimal formatting of an error message is going to be for like in the generic case. And so I think oftentimes it's good for us as programmers to take the error diagnostic and then like see if we can sort it into something that's a little bit more manageable ourselves.
ConorI think there's a there's a tool that Vittorio Romeo has written that I do not recall the name of, but it actually is like you pipe your compilation uh into this, and then you can set the level of like uh nesting of the brackets that it shows. So by default, it like collapses all of it, and then you get like a much more succinct, and like the idea is you can keep running it and increasing the level until the message that you or the info that you need is there, which is kind of a neat idea.
BryceUm one interesting problem that we have in the C space is the question of um uh when you dump out an error um that's got um some sort of uh stack to it, you know, like template instantiation uh stack, um, uh, you know, which direction do you do you output? Most compilers um uh output um uh from like like the original source of the error all the way down to where it was triggered from. Um and I think that's actually not very helpful um because like you you see it then when you get this long error dump, the last thing is going to be the first thing that you see. The last part of the error message will be the first thing you see. And if you see instantiated from here within main, you know, the place where it was instantiated from is maybe not the most helpful thing. Oftentimes the most helpful thing is what the the root of that of that tree of this was the error that happened. Um, I think the only compiler I've seen that does it the inverse direction, if I recall correctly, is I think circle does it the other way around, um, which I have found to be quite interesting. I'd love to see that be a switch for which direct which which uh you know to reverse the template instantiate the error instantiation like message order. I'd love to see a switch for that so that I could I I would probably switch it by default because like almost always what I do is I is I scroll up to the start of the error and I read the error from the start down.
Patrice RoyDo we need the clang format kind of tool for error messages?
BryceYeah, I I was just thinking that. I was thinking I want clang format for error messages.
Patrice RoyYeah, that would be cool. It would be an actually nice project to write.
BryceYeah, somebody, somebody get on that.
ConorYeah, I'm sure there's something out there. Um after this podcast, there will be. Thanks for listening. We hope you enjoyed and have a great day.