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 85: Special Guest Tony Van Eerd! (Part 2)

Jul 8, 202232 minAudio

In this episode, Bryce and Conor continue their interview with special guest Tony Van Eerd! Twitter ADSP: The Podcast Conor Hoekstra Bryce Adelstein Lelbach About the Guest: Tony Van Eerd has been coding for well over 25 years, and hopefully coding well for most of that. Previously at Inscriber, Adobe, and BlackBerry, he now enables painting with light at Christie Digital. He is on the C++ Committee. He is a Ninja and a Jedi. Show Notes Date Recorded: 2022-06-24 Date Released: 2022-07-08 Mike Lazaridis BlackBerry BlackBerry Bold Photo Chandler Carruth (Google) on Twitter ADSP Episodes with Chandler Carruth Gary Klassen (BBM) on Twitter Olivier Giroux (Apple) on Twitter Jon Lakos (Bloomberg) on LinkedIn David Sankel (Adobe) on Twitter CppNorth Conference Tony’s Talk at CppNorth: Value Oriented Programming. Part 1: You say you want to write a function ADSP Episode 24: C++Now 2021 with Ben Deane & Tony Van Eerd Complecting Made Easy - Tony Van Eerd [CppNow 2021] Dr. Dobb’s “How Non-Member Functions Improve Encapsulation” Scott Meyers Books What is unified function call syntax anyway? - Barry Revzin C++20 std::basic_string::starts_with 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.

BryceThat's unified function call syntax.

ConorUnicorn. Unicorn. Unicorn. Yeah, it should be called unicorn because we're probably never going to get it in C.

BryceThat's this is before your time in the committee, Connor, but that that's exactly the joke.

ConorOh, is it? Yeah. Welcome to ADSP The Podcast, episode 85, recorded on June 24th, 2022. My name is Connor, and today with my co-host Bryce, we continue part two of our four-part interview with Tony Van Eard.

Tony Van EerdHere's another story I just told the other day at work. You would get bugs, right? You know, I like I'm working on Blackberry. We'd get a we get a bug report that, you know, someone's typing and scrolling, and there's the trackpad, and it got confused about whether you were touching the screen or the trackpad or the keyboard because they're all so close together and stuff, right? And it's like, hey, can you can you like filter out the the mistaken touches, right? Like if you're swiping the trackpad, you want to not you want to ignore the screen.

Tony Van EerdYou you didn't mean to touch the screen. It was just too close to the trackpad, right? Which of course I had told them when they were making the phone that they put the trackpad too close to the screen. But anyhow, it's like fix it in software, right? Um so I got I you get these bug reports like that, and the the bug is called a Mike L bug because it's not someone complaining, it's Mike L complaining that he was he was scrolling his trackpad and it and he got screen input accidentally, right? And um, so those were like obviously high priority bugs because it's oh, it's a Mike L bug, you gotta fix it right away.

Tony Van EerdAnd my manager would take that part out of the bug. If it said Mike L bug in there, which everyone just knew what that meant, he would just remove it and leave a comment saying, remove superfluous information. Because my manager was just like, I don't care whose bug it is, it's either important or it's not important. And we're just like, man, you're just trying to get yourself fired, right? But but uh he would do that. Um the other part of that story is that I every now and then I would be like, okay, I need to know was he scrolling up because he touched the trackpad and then the screen, or was he like scrolling down, he touched the screen, then the trackpad?

Tony Van EerdBecause you know you're gonna handle that differently. It's easy to say it's easy when you touch the screen, you can say, Well, did you just touch the trackpad like this many microseconds ago? Because I'll ignore the screen touch, right? But if you go the other way and you touch the screen and then the trackpad, am I gonna delay every screen input to say, well, let me wait, let me wait to see if you touch the trackpad, right? Yeah, I think I ended up actually with there's a region at the bottom of the screen where I do delay the touch input because it's like, well, wait and see if you touch the trackpad.

Tony Van EerdUm but anyhow, I needed to know which what you know, and it's like someone go ask Mike L what was going on, like, give me more information. And the people that because he's not obviously not logging his own bug, right? Someone else logs the bug for him in this into the system. You ask that person, it's like, I need more information. And they're like, Oh yeah, we'll uh we'll talk to Mike and we'll come back to you. And they never get back to you because they don't talk to him because they're afraid to, because he's the big bad boss, right? And so finally, one day we you know, every every company has their all hands and all that kind of stuff.

Tony Van EerdSo I went to one of the all hands, I waited to the end. Mike Ells does his stocking. I walked up to him at the end, I said, Hey, I got a bug. I need to know. Like, tell me, tell me, I need more information. And he's like, Oh yeah, sure, no problem. Blah blah blah. We talk about this bug for five minutes. And I told him, I said, Look, I've asked for this information, no one will give it to me. And he's like, just come to my office. Just come find me. And I'm like, excellent. I am now like firsthand, you know, first name basis with Mike. Just like, hey buddy, Mike, you know, just walk in when he's got a big meeting with somebody.

Tony Van EerdSay, Mike, I just gotta just got everybody stop for a second. I got a quick question for Mike here. I gotta He's my guy, my guy Mike, you know. I'm important. Yeah. And then I left the company. So and I didn't actually get to use my power, I don't think. It was right before I left.

ConorAnd for those of you that are extremely confused on why uh Tony was talking about a trackpad on a cell phone, uh, I will link a I will link a photo of I'm not sure, I had a Blackberry bold. I think it had one of those track pads.

Tony Van EerdYeah, you had a Blackberry? He's Canadian. We give we give every Canadian gets one when they're when they're born. Yeah. When you when you graduate high school, you got one.

ConorI had a flip phone or slider phone when I graduated when I was in high school, and then I used that into university. But as soon as I had my first co-op at Manu Life in Toronto, I thought to myself, well, I'm I'm joining the business world. I'll be ostracized if I show up, show up without a Blackberry. So I bought a Blackberry bold.

BryceWait, wait, you had an iPhone.

ConorI did not have an iPhone, I had one of those flip phones or slider phones.

Tony Van EerdGotcha, gotcha, gotcha. The early days. Um, anyone who's played NHL video games, right? NHL 2K, even like 2K14, 2K15, I don't know when it stopped, but um, there's like the trading, the general manager mode where you can trade players with other teams and stuff. It shows a picture of a Blackberry phone as like, hey, you're getting a call from you're getting a call from you know Vancouver Connects. They want to make a trade. And it shows a Blackberry phone. And I'm sure Blackberry paid to get this like advertising built in, but it was also true.

Tony Van EerdEvery that was that was what it would be like to be a manager. Every manager had a Blackberry. There's there's no doubt that every you know GM in the NHL and every sport was carrying a Blackberry so that they could do their their stuff, right?

ConorYeah, BBM was like kind of not really like Messenger, but it was like um you could only message people that had BBM, right? Yeah. So like it was this, it was like, you know, I'm not sure if it was before uh Facebook or whatever, but it was tapping into the whole, you know, uh same thing with Bloomberg, you know, you can't message people. I think that's changed, but at one point in time, people on Wall Street, like you were outside of Wall Street if you didn't have a Bloomberg animal.

Tony Van EerdYeah. It's the same thing, it's like critical mass. Everyone's there because everyone's there. Um everyone had BBM.

BryceAnd then or or or well, or like the you know, the the green bubble versus the the blue bubble on iMessage. You know, are you are you another trusted iPhone user or are you the other?

Tony Van EerdYou know, uh Chandler, if he ever listens to this, is gonna like, yeah, just tell him now. Chandler, just you 10 seconds, you gotta cover your ears because I'm gonna say the word patent. But um I think BlackBerry has a patent on speech bubbles in like iMessage and stuff like that. Like Gary Classen, the guy who wrote BBM. And so every phone in the world, you know, does speech bubbles. Um and I don't know, you know, it's it's corporate, you know, patents, right? The way you know they no one sues anyone unless everyone sues everybody.

Tony Van EerdAnd I don't know.

BryceYeah, it's uh it it's new, it's the Cold War.

Tony Van EerdSo here's the thing, back to the patent story. Um BlackBerry, when I was there, had 40,000 patents, right? 40,000 um mobile, you know, in in a good industry patents, right? Um and then someone sat down, like, how do you figure out how much that's worth? Do you look at all 40,000 patents? No. You take a you do a sampling, right? You sample some number of patents, and you look at them and say, well, this one's worth this much money, this one's worth this much money, you make some kind of guess at how much this patent is worth, and then you average it out and you say, Well, every patent here in this portfolio is worth about $100,000.

Tony Van EerdAnd so the whole patent portfolio is worth $4 billion. So, like BlackBerry, even if they did nothing else, was worth $4 billion because they're sitting on $4 billion worth of patents, right? But that also means that if I write another patent, it's worth $100,000. It doesn't matter if it's good or bad, right? Because as long as it's a patent, it goes into the pool of well, on average they're worth $100,000. So every patent I wrote is another $100,000 on their books.

Tony Van EerdSo I'm just like, I'll just how many do you want? Do you want 10 patents? I'll write 10 patents. I wrote patents for like um uh uh the the the watch, right? Like you know when the when the Apple watch came out, I'm like, how do you uh you know, and I won't get into these, it's okay, Chandler. I w I won't get into these patents, but like how do you input text on a watch? It would be really hard, right? Because it's like a small surface. Um, but if you really want to input text on a phone, on a on a watch, I thought up 10 ways of doing it. And so I wrote them all down, right?

Tony Van EerdAnd it doesn't matter if BlackBerry would ever implement those patents. They wrote I wrote them down and they send them off. And some of them get you know accepted as patents and some don't. And then they give me money. That's that's what I did. I just I was like, man, I can make more money by sitting here in an afternoon writing patents.

BryceAnd uh and well, it's it's just like how like at NVIDIA they give me they give me a referral bonus every time I recruit somebody, and like it's it's I could just turn that into a full-time job. You know I have like a whole system. I have a whole system.

Tony Van EerdYou know uh John Lakos would tried to tried to tried to recruit me to be a recruiter. After after he gave up recruiting me, um, he was just like, Can you find me stuff? Because he said he's like the the amount that they would pay a recruiter for finding somebody in New York, right? Is like a huge portion of the person's salary. And he's like he's like, I will give you the same percentage if you find me people. And and I can still stay in because every time he tried to recruit me, I'm just like, I don't want to move from Canada, I don't want to live.

Tony Van EerdI mean, New York's great, I just don't want to live there. Um and uh and finally he gave up trying to recruit me, but he's like, Well, find other people, and I was like, I could probably make more money recruiting people for Lacos than programming on my own, because like I'm getting a percentage of some New York salary, but I'm living in Canada. And then I was like, except for I don't want to be a recruiter, so screw that. But every now and then I'll get a co-op student, which for you non-Canadians is intern.

Tony Van EerdI'll get an intern who I know doesn't want to work for me, and I'm like, hey, do you want to work in New York? Because man, I can set you up. I also just tweeted one from one of my interns. I'm like, who wants my intern? She wants to work at like Apple, and then Olivier's like, send her my way. So see, I I've always terrible nepotism right there.

BryceIf I didn't want to work in engineering anymore, I could go start like like I couldn't do a startup. I don't have any good startup ideas, but I could I could definitely start a recruiting company, and it would be a killer recruiting company.

Tony Van EerdSo this this is the same thing, right? Like, so Gary and I left BlackBerry.

ConorAll right, pause, pause, pause. Let's just do some filling in here because I've realized we're doing like uh what do you call it? Like inside shop talk. So uh Chandler works at Google. Actually, no, our listeners know because we've had Chandler on.

BryceOlivier Listeners who've listened to every episode.

ConorYeah. Everyone knows Chandler anyhow. If you're in the C community, I mean we're slowly becoming predominantly C, but historically we were uh we would talk about other languages at China.

Tony Van EerdShould we be talking about erase? Sorry. No, don't worry.

ConorUm, but so Olivier, formerly at NVIDIA, now at Apple, and uh is uh from Quebec, Canada. Uh Lakos refers to John Lakos. He works at Bloomberg in New York. Previously, are we allowed to mention that? The other well-known C person that is no longer at Bloomberg? I don't know which one you're talking about. Is that public knowledge?

BryceOh, yeah.

ConorWe can say that. Yeah. So David Senkel used to work at Bloomberg, but now is that Adobe? Yeah. So it's it's right now it's NVIDIA versus Adobe. I'm not sure which one's Marvel and which one's DC, but we're just collecting, you know, like Whoa whoa.

BryceThat's a bit of an exaggeration. Nvidia has a much has hired a lot more C people than Adobe. Adobe's hired like one or two.

ConorOkay, so Adobe can be DC. Um, I apologize, Sean, if you're listening. Uh maybe he doesn't watch any superhero movies, so he doesn't know the difference.

Tony Van EerdThey've got they've got some like they might not have the the quantity, but they've got quality. Right?

BryceI got quality too.

Tony Van EerdThey've got Sean Parent.

BryceI got Andre.

Tony Van EerdThat's true. All right, all right. I got wait, wait, Dave Abrahams, Eric. Okay. You we're tie. I think we're still tie. Darn it. All right. But then but on top of that, I got a lot of other people. Yeah, but then there's you. So that's like a down. Like they they also have Sean.

BryceWe don't have a Sean.

Tony Van EerdYeah.

BryceWe had it, we can't we can't. I mean, we had Olivier, but now Olivier has gone down.

Tony Van EerdSee, that could have put you over the edge.

BryceYeah.

Tony Van EerdAll right.

BryceThere was like the there was this one week period where before Olivier left when uh when Andre had just joined. And that was that was the peak, peak C that NVIDIA.

ConorAnyways, I interrupted because you said when me and Gary, and I was like, all right, I don't know who Gary is, so we gotta we're gonna update update people, and now you can tell me who Gary is.

Tony Van EerdI mentioned Gary. Gary, it's Gary Classman, the guy who wrote BBM. Oh, right, right, right. Okay. Um by the way, so Gary works at Google now. Works at Google in Warloo. Gary is the most energetic person I've ever met in my life. He's the most upbeat, energetic. Like for the first two or three years I worked with him, I'm like, I don't believe this person. I'm just like, there's not, it's not possible to be this upbeat and energetic and positive, and but he just is. That's just how he is. And he's still that way. I've known him for like 10 years.

Tony Van EerdYeah, he is. Yeah. Um interesting. Yeah, he is just awesome. Anyhow, um uh he left Blackberry and I left BlackBerry like near the same time, but not at the same time. And uh we ended up working together here at Christie, and we were both sitting here at Christie, and I was like, Gary, you left Blackberry, and at least in this area, he is known as you know, the guy who invented BBM. And in this area, BBM is still a big deal, right? Because BlackBerry was a big deal.

Tony Van EerdI was like, Gary, we could have started a startup with just your name. Just be like Gary Classans doing a startup. Just like one of these, any, you know, think of all the people like if Sean Parent went and said he's gonna do a startup, right? People would throw money at him this just because he's Sean. And Gary would definitely we could have and I was like, Gary, we'll think of something, but we could just do a startup and then later from a patent writing machine. Yeah, we'll figure out what we're gonna do later.

BryceYou will pat you will patent a process for developing patents.

Tony Van EerdHas anybody ever thought about that? Oh, for sure.

BryceThat's probably a good idea.

Tony Van EerdI mean, you could probably now get oh, I've got so many sad, scary things um that popped in my head there. Um one is that you could get uh an AI now to write patents for you, probably, right? Just pump out some patent crap.

BryceAnd uh And then of course you patent you patent that AI.

Tony Van EerdYeah. So you know everyone's talking about the AI that could be sentient, but not really. Um and it's like, yeah, it can't be sentient, but how long before that AI is used as uh a Twitter uh bot that you can't tell anymore that it's a Twitter bot? Right? Because that's where we're at. And it's gonna get really, really hard for for Twitter people to figure out, oh, this is a bot that's just you know spreading information and this is a real person. Um because right now it's still, you know, you can do it with a computer, figure out you know, bots, sort of.

Tony Van EerdBut um these you know AI things are getting way too good at look, you know, sounding like a real thing. Kind of scary. Anyhow. Don't want to put that idea out there for your for those uh you don't want to. Okay, good. Well, we'll make sure that we're gonna go. No one listens to this.

ConorThat is true. Not as many people as CPP casts, that's for sure.

BryceUm we'll get there. We'll get there.

ConorSo what are we doing?

BryceWe may not we may not have quality, but we have consistency.

ConorI mean, they had both, so what are you uh oh there goes my video. What are you um so speaking of, we haven't even talked about uh our incoming party, Canadian party. I mean they're calling it a conference, but we'll call it what it is. It's a party. Yep.

BryceIt's it's a week, it's a week-long birthday party for me.

ConorOh yes, that's true. It's been a while since you brought that up. I've uh I forgot. I shame on me for forgetting.

BryceHow could you possibly have forgotten? I've sent you I sent you a calendar invite this week for the Bryce birthday.

Tony Van EerdI'm sure he doesn't have to worry about forgetting. Um sure he will be reminded even. I don't think that was this week. I think that was previously.

ConorBut so you're speaking. Yep. You're not only are you gonna be there, you're gonna be speaking. Yep. What uh give us a little, give us a little give the listener and potentially the listenerslash attendee a a preview of uh what to expect.

Tony Van EerdUh I'm gonna talk about functions. So um here's the thing. Every time for the last like three or multiple years now, every since Sean gave his first talk at BoostCon, um, which was like the first BoostCon talk of BoostCon, um this whole thing of like value, you know, the kind of what I like to call value-oriented programming instead of object-oriented programming, right? Which, whatever that means. But like Sean talks about it, Dave Abrahams talks about it.

Tony Van EerdUm and it's really hard to actually describe it and everything. So I'm constantly trying to, I keep telling myself, like, let's do a talk on value-oriented programming. And we'll just we'll just explain to people what value-oriented programming programming is, and and then it's like, and then the more importantly, it's why is it what's the value in value-oriented programming, right? And then I'm like, whenever I start doing that, all I end up talking about is functions. So so I'm like, screw, screw values. I'm not gonna talk about value-oriented programming. I'm just gonna talk about functions.

Tony Van EerdBecause I don't know if you ever looked at code before. Um, people don't know how to write functions. It's uh it's kind of scary. Uh functions, functions are uh I've seen a lot of seen a lot of bad code in my years.

ConorSo correct me if I'm wrong, but the title of your talk is value-oriented programming.

Tony Van EerdThe title of my talk is value-oriented programming part one. So you want to write a function. So it's actually a talk about functions. In the in the world of value-oriented programming.

BryceSpeaking of uh talk titles, uh, I need to uh I need to change my talk title and description because I'm now given a different talk at C North. Oh consider this your formal notice, Connor.

ConorAlright. I will change uh I will update your uh your talk title. So I guess why we don't need to give away the whole talk. Um and by we I mean you, because I'm not the one giving the talk. But uh why don't people know how to write functions?

Tony Van EerdI mean I've uh why? That's a good question. That's a separate question I have an answer for. But but what you really what you're re what you think you use certain words, but that's not what you meant to ask. What you were asking is why do I think people don't know how to write functions? Well, you just said people don't know how to write functions. Right. Do you think people know how to write functions? Have you looked at code? How much bad how much bad code have you seen in your life? You're just a young guy. I'm definitely not as much as you. Yeah.

Tony Van EerdYeah. What that's what I didn't well, you make it sound like I wrote bad code. No, I've just seen a lot of code in my life, yeah. I'm guessing you've done a lot more code review. Yeah. So most code is bad. That is just it doesn't matter where I've worked, most code is bad. Um and uh one of the it turns out that one of the things is just I asked this question the other day. What is the fundamental building block of programming? And you know, you might say classes. Classes are like objects.

ConorThose are I mean that it depends on who you ask.

Tony Van EerdYeah. Well, the real answer is functions. Functions is the real answer. Functions?

BryceYeah, yeah.

Tony Van EerdNot much happens without functions.

BryceClasses are just like complicated parameters to functions.

Tony Van EerdSo, so so functions are the real building block, and they don't get used very well. Um you know, how many, you know, you find functions that are a million lines long, um functions that uh just you know modify their input parameters instead of taking, you know. But now the real question you asked though is why are functions so bad, or whatever you asked. And this this this was this even the last time I was talking to you? Yeah, the last time I was on this without without Bryce, but there was uh uh Ben and and and I, right?

ConorYep, yep.

Tony Van EerdI'm I did the uh lightning talk on complexing. Complecting made.

ConorOh yeah, yeah, yeah. Yeah.

Tony Van EerdThat is why. And and this is to this day, this is my my I this is my favorite talk, even though it's like a five-minute lightning talk. Um and it's not even that the talk's good, it's that the idea in my head is good. Um uh complecting made easy. Every step of the way when we're coding, the easy thing to do makes your code worse. Right? When I need to change, you know, like you're you're sitting down, you've got a task to do, and it's either fix a bug or add a feature, you know, like that's that's typical.

Tony Van EerdWhat you're doing, right? It's like, oh, I gotta go in here and change this code. And so what you do is add an if statement wherever you need to add that if statement and like do some stuff. And it's like, oh, this is gonna fix that problem and blah, blah, blah, blah. And you just add some code, just right in the middle of this function. You're probably in the wrong function because, but you went to this function because that's the code you knew. You didn't know the other code over there very well. So you started here with the code that you already knew, right? And you're like, oh, I could fix this from here. If I just do this, I I call this other function, it gives me the wrong answer.

Tony Van EerdBut if I add 0.5, then it's the right answer. So, you know, I'll I'll add 0.5 or whatever, which is literally happened today. Like, because I do computer vision stuff, and the answer's coming back, it's off by half a pixel because people don't agree what like is zero zero the top corner of the first pixel, or is zero zero um the middle of the first pixel?

BryceRight?

Tony Van EerdRight. It's two different coordinate systems, so you're off by half a pixel a lot. So it's just like, oh, if I just add 0.5 right here, it's gonna fix my problem. Well, it's like that's not the right place to add 0.5, but it's the easiest place to add 0.5. So you just do the easiest thing. And then it's like, um, should I add a new function for this? Well, that's harder than just writing the code in this current spot I'm at, right? Should I uh put this code in this class here, or should I put it in a separate class? Or should I just put it in a separate?

Tony Van EerdIt's just a free function that should be somewhere. And then if I tell someone, oh, make that a free function, it doesn't have to be a member of the class. They're like, Well, where do I put it? What CPP file do I put it in? What header do I put it in? And it's like, well, make a new header, make a new CPP file. It's like, oh, okay. But that's hard. I mean, it's not hard, but it's harder than not doing it. Every step of the way, these these little things, it's easier to change an existing class than to like refactor it or separate it or whatever.

Tony Van EerdNow, maybe you always do the right thing. Maybe you know, you're a good programmer and you're like, why would anyone just do that? You would of course you would refactor when it needs to be refactored. Or of course you would write a new CPP file, a new header when it's a free function that you know is only partially associated with this class and it shouldn't be in the same header. But no one does that. Everyone just puts it wherever is easiest. And so many things we do are like that. So why is code bad? Because complexing is easy, it's the easy path.

Tony Van EerdAnd good code is the hard path. That is my biggest insight of my life.

ConorSo here's a super specific question in response uh to that very high-level wisdom. I remember at one point in my first job coding in C, uh, where I had this class, and I had basically a function in that class that was only using a single member, maybe there was five or six members, but everything else was passed in as a parameter. And if you've read, I'm sure many people in the C community have either read Scott Meyer's books, and I think also there was an article on Dr.

ConorDobbs, which is like way before my time. But do you want the link?

Tony Van EerdI I I have I have slides with the article. It's encapsulation. Uh free functions improves encapsulation or whatever it's called.

ConorRight. Yeah, exactly. And that's it's translated. That article is translated into one of the points in one of Scott's books, but it's basically gives you this hierarchy of sort of the four levels that you should prefer. And you should always prefer non-member, non-friend functions if possible. And I remember writing this code initially and then was reading Scott's book at this at the same time. And I I realized that, oh, this only, you know, it relies on the ID, which was just an integer. Clearly, I can move this outside and just pass the ID.

ConorJust pass the ID and poof, you're done. But I was so conflicted at the time of doing this because um it was like the it was like a calculating something from you know some information and and you were passing in the table and all this stuff, and the ID was it doesn't really matter, but like the the function went with the class. Like they were bundled together. And when you're writing this class, based on how most C IDEs work, you go write the class, you go dot, poof, and it gives you the options to select from.

ConorAnd as soon as you move that outside, even if it's in a namespace, we don't have uniform function call syntax, and most IDEs aren't going to recommend you. I have heard that in like C Lion for certain algorithms, uh, it it does have some amount of uh recommending of like, oh, you might be able to use this free function. But I've always been torn because I know specifically that some other languages, like they specifically lean towards that design of like the friendliness of member functions and just being able to go dot and have autocomplete.

ConorAnd even though I completely agree with the article and Scott's point uh that you know, that's how encapsulation that's what it's designed for. I've always been like slightly torn just about the ergonomic, yeah, like you know, the the experience of programming and having member functions automatically. And like a part of me thinks that the answer is that, well, we just if we had something like UFCS and IDEs were designed, it would be the same experience.

BryceBut like unified function call syntax.

ConorUniform.

BryceUm but yeah, we don't we don't have that.

ConorUnicorn. Unicorn. Unicorn. Yeah, it should be called unicorn because we're probably never gonna get it in C.

BryceUm that's this is before your time in the committee, Connor, but that that's exactly the joke.

Tony Van EerdOh, is it? Yeah. It's it's not it's not a new joke. It's uh it's not the first thing that's been called a unicorn either.

BryceThere's other unicorn uh like unicorn initialization.

Tony Van EerdI wasn't gonna say it, but yeah.

ConorBut anyways, interested to get your thoughts.

Tony Van EerdUh so yes, there there is a nice ergonomics with member functions, right? Um but long-term, it's long-term detrimental to your code base, basically. That's the problem, right? Like, how many how many things can you do with a string? How many functions can you write with string? Like infinite number of functions you could write with a string, right? They can't all be member functions. So at some point you got to draw a line and say this is not important to be, you know, because if if it really is like the the the first set of rules are just like, well, do you need the internal member variables?

Tony Van EerdIf you don't need them, that's a good sign it doesn't need to be a member function, right? But it's not the only thing. Um as an example, and like on the committee, um, I argue this sometimes. I back back in the day when we used to have uh meetings in person, I remember arguing this. Um like string has 200 member functions or something. It's it's terrible. It's a terrible class. Um and most of them could have been algorithms because they don't have to just work on strings, they can work on vectors and other things, right?

Tony Van EerdUm and then we introduced um starts with, I think, is is the one of the recent functions we added to string, right? It's a member function. And I argued that it should be a member function. Um but that's because the ergonomics are so bad when it's not. Because if you have a function it's called starts with and it takes two strings, you're like, oh, which one's like the needle, which one's the haystack?

BryceRight.

Tony Van EerdRight? And and it's hard. But if it's you know uh haystack dot starts with needle, no one is confused about about what that function does.

BryceClearly we just need infix binary functions.

Tony Van EerdYeah, that could be the answer too, right? Yeah.

BryceUm that's what Connor is thinking.

Tony Van EerdYeah. But but either way, the the you know, there whatever for every rule out there, there's gonna be exceptions, you know, things to balance out. The answer in C is always it depends, right? Um But uh the more member functions, so I like to say that classes are made of Velcro. Um the um classes are made of Velcro, right? You you you continually attach more things to the class. And then you start attaching functions to the class, and you're like, okay, this here's this thing that goes along with the class, we'll attach it.

Tony Van EerdAnd then you add attach another function, and then somewhere down the road you're like, oh, this function doesn't really work unless I have this other thing. Oh, to fix this, I'm gonna add another member variable to the class, right? And now your class has gotten bigger. You didn't just add new functions to it, you added new, you know, stuff in your class. And a class becomes this nexus point of entanglement where everything goes through this class, right? If you change one function or one member variable of this class, you might have broken all these functions, right? Because it's all, you know, they can all touch the internals, and you've got like 200 member functions you have to worry about breaking when you change something.

Tony Van EerdAnd you that's you've you've entangled classes are points of entanglement unless you're careful about it. So that's yeah, that's how that's the other way you complex things is by you know someone I I had someone um I I I can't can't give away what I my my my interview questions, but um had a question about you know two points and and you know some function you could do on some points.

BryceSo Tony Tony, it's not like you're on a popular podcast. You can give away your interview secrets.

ConorUm basically it's tune in next week to hear what Tony's interview question is. Thanks for listening. We hope you enjoyed and have a great day.

Open the transcript file

Hosts and Guests

Guests

  • Tony Van Eerd 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