Jane Losare-Lusby

Right now, the prevailing attitude is more aligned with your attitude, which is like all the programming languages, like there's not one right way to do things that all the programming languages have value, and we should all be learning from each other.

Conor

Welcome to ADSP the podcast, episode 107, recorded on November 2nd, 2022. My name is Connor, and today with my co-host Bryce, we continue part two of our conversation with Jane Lazari Lesby on the Rust programming language. Be sure to check out part one, link in the description if you haven't yet.

Jane Losare-Lusby

And so into iter, like you went with a vec, you can take a reference to a vec and call and like put that in parentheses. And like so ampersand, vec variable identifier, parentheses, dot into iter, and that will do the reference to into iter like trait implementation. So it's like for like a reference to any type that implements into iter will do, or I think it might actually be a direct implementation on reference to vec. I'm not positive on that one. Um whereas iter is just a free function associated with the vec or possibly the slice type that will just basically do the exact same thing that or if you like were to give it a reference in front of it when you call the into iter, it's going to give you a like iterating over references iterator. Whereas you call iter, it's always gonna just do the iterating through references iterator. And so calling iter is useful in situations where you don't want to have to deal with like adding that reference at a time. You just want the auto ref to like handle getting through going through the slice or dereferencing or whatever is necessary because it like it knows the exact type it's gonna be resolving to, versus into iter, it's a generic receiver. And so it can't you could write run into inference errors sometimes or you might or might end up like iterating by owner, like owned values or something. Um, and like intuitive is more flexible in that like you can have like owned iteration or non-owned iteration, and it's actually implicitly called in for loops. So when you put when you add the iterable item to the like the the second expression in the for loop. So you have four variable identifier in expression, um, that is expected to be a type that implements into iter. And iterators, like the iterator trait is like reflexively implemented for intuitors. So if you give it an iterable type, it just automatically is itself. Um I guess that's an identity conversion. Um and but like if you were to just give it a vec with behind a reference, like a variable named the to the vec behind with an ampersand in front of it, then it will iterate by reference. If you did a mutable reference in front of that vec, it would iterate by mutable reference. If you just did the vec itself, it will take the vec by like owned value, take it apart, and iterate by value and destroy the original vec in the process. And it's like all you have to do is like what reference you put in front of that variable determines how it gets iterated by the into iter trait.

Conor

Interesting. Yeah, that makes sense because I think one of the times that um Clippy modified it from an into iter to iter was when I was using the Windows function, which I think was returning slices or something like that. So that makes sense then because it was potentially uh unnecessary what I was doing there. Cool.

Bryce

I have a question now. How do you um how do you write um traits in Rust? Like how do you express a constraint? The the way that it's done in C ⁇ I find very um quirky. So in C ⁇ you it's done essentially through these like usage patterns where you um uh you say like, oh, suppose I have a um an object X of this type that I'm constraining, and then uh you have to be able to be able to call you know this thing on X and then that thing on X, and if you call this thing on X, it returns this type. Um so what's it like in in Rust? How do I how do I describe a trait in Rust?

Jane Losare-Lusby

So it's I can't remember like the like the formal terms, but like basically instead of describing what the type needs to conform to, you it's it's kind of like an abstract class sort of thing. Like you're describing the interface. Yes, and when you implement it, you implement that interface within the impl block of the trait. So for like normally, if you're if you're defining like a free function for a type, you like have open up a block that's like impul type and then open but open block. And within that is where your functions go, and then you have you can like have a self as one of your parameters, and that's gonna refer to the type in the impl block, et cetera, et cetera. When you're doing the trait function implementations, you're gonna do impl trait for type. And but otherwise it's gonna be the same thing, but like the functions in there are going to be only the functions that are defined in the trait. You can't just put like random functions in there. And if you like implement that exact function in like a just as normal input block, it doesn't get associated with the trait. It is like it has to be in the traits input block. And you might be able to have the same function name in two places and then just cause like fun ambiguity errors where you have to like specify the like the long form like at like type as trait colon colon function name or something like that. Um pretty sure that works, but not recommended most of the time. It's probably just gonna cause problems.

Bryce

So that that that that's sort of how I want to be able to write concepts in C ⁇ , but can't. And there were proposals at some point in the history of uh of C that allowed you to write concepts like that, but um they went away. Um uh is the polite and simple way to say that.

Jane Losare-Lusby

If I could if I could ask a question about C, how's the pattern matching proposal or the patterns proposal going? I know there was like some work there.

Conor

It's not it's not C 29.

Bryce

The thing is that a lot of um development of a large part of the the feature set of C has stalled because the the um the C committee process was not well prepared for the pandemic, and the C committee um admirable attempts were made to adjust to the new world, but um the reality is that a lot of work uh stalled out um over the past two years. So there's a proposal that two years ago like looked like it was on track, but um I don't have I don't have high hopes for things that have not made progress in the past two years, even if they were in good shape two years ago, because um disruptive. It's disruptive, best practices can change. I think people are maybe surprised to hear that, but the the best practices you know, within even within a big language like C that moves slowly, the best practices do evolve. Um like we, the people who are building the language, we learn over time, um, mostly through making mistakes. And then we're like, well, you know, we don't want to do that again, so you know, we should do this instead. And so the best practices evolve, and then the more time that your thing goes without being updated, the further and further away it is from the state of the art. Um and uh and that that makes it harder for something to come back even if it was mature before. And I think that this is ultimately what happened to some of the bigger features of C ⁇ and recent memory that have um that have stalled out or that the committee has has in some way rejected. Um like the uh the the networking TS is is one. It was something that was evolved in the you know mid 2010s and uh uh we published a TS on it and we got it pretty close to being ready to go into the standard. Um but then the best practices you know changed a lot, and um uh then there was resistance to uh updating it, and also it was a big thing. So um, you know, when you've got a big proposal that nobody on the core team has looked at in two years, it's gonna take a while for everybody to get familiar with the thing again. Oh yeah. Um and then that means that it takes longer to get started working on it again, and so then it becomes more out of date, and it just it if you're not constantly making progress on a thing, uh uh it it's m more likely than not gonna become abandoned.

Jane Losare-Lusby

Yeah. Yeah, no, I I I I know that from library team work, like it's the longer the gaps between reviews, the the more just the more difficult it is for like everyone involved.

Bryce

Well, it's it's like we see this a lot um with like software updates, like uh at NVIDIA, um it's been a a um a struggle over the years for me to get um various internal teams and SDKs to move to newer compiler versions and to drop older compiler versions. Um and and one thing that we repeatedly see is that the um if you update from you know upstream once a month um versus once a year, um you're actually doing less work if you're doing it once a month. You might think, oh well, well, we update once a year and like you know it'll be 12 times as much work um than updating once a month, but it's actually probably more like you know 20 times or or 40 times because uh the the the cost of making all those changes um uh all at once instead of doing them incrementally is far greater. Um and you don't really um you're you're not able to start making changes um uh uh uh sort of naturally as things evolved. You end up in the situation where like, oh now we have to do this whole big refactor to update to the newer thing. And then, you know, of course, that takes time, and then that means that it's longer until you've updated to the newer thing, then there's more changes that you have to deal with, and again, you end up in this uh death spiral of uh of sadness.

Conor

I mean, on that negative note, you did still highlight it in your top three. Bryce just gave a keynote a week ago at O3D Con in Texas, and one of his top three future C features was pattern matching.

Bryce

So it's good stuff. Those top three features that I highlighted were um reflection, um, pattern matching, and um and senders. And uh I mean I guess.

Jane Losare-Lusby

Senders like channels?

Bryce

Yeah, more or less, yeah. I'm I'm gonna say yeah, and there are a bunch of people who I work with who um may be upset at me, but yeah, you you have the basic idea.

Jane Losare-Lusby

Okay.

Bryce

Um but yeah, I mean I think that those are the the the most transformative things that C could do outside of um, you know, ob obviously I think uh the the whole question of package ecosystem is uh probably more transformative. I've said for like a while that the most single most important thing that C committee could do is to figure out a story for the packaging ecosystem. Um and then improving the C committee evolution process. Yeah I I saw something on Twitter earlier today um that really stuck with me, which was something in the effect of um junior engineers think about how are we gonna solve this technical problem? How are we gonna do this thing? How are we gonna execute this thing? Um whereas senior engineers think about is this team positioned for success? Like, do they have the support that they need? Are they are they um uh are their their metrics and their KPIs set up in a way that they're gonna be successful? Um are they happy, etc. Um and uh that really ring true with me. Um and that's one of the reasons why I care so much about the um the the health and the um that's the word I'm looking for and the modernness of the evolution process of a project. Um because if if your thing can't evolve and improve, it doesn't matter how good it is, eventually other things that can evolve and improve faster will outpace it. Yeah.

Jane Losare-Lusby

Yeah.

Conor

Yeah. I didn't mean I didn't even when I was listening off all this stuff, I didn't even mention, yeah, the package system crates crates.io.

Bryce

Yeah. Although I I I do have a bone to pick with Rust here.

Jane Losare-Lusby

Oh.

Bryce

Um so my understanding is that the Rust uh uh crate system is uh still as a model where everything is built from source, yes.

Jane Losare-Lusby

Yes.

Bryce

And there's no binary distribution.

Jane Losare-Lusby

Uh no, but they're they're they're looking at starting a project right now for uh uh a safe ABI. So there's like an like we're gonna look into trying to find a way to have a subset of the language that we can expose as like a stable API ABI without having the entire like Dyne linked ABI be stabilized.

Bryce

Yeah. So so my my my bone to pick here is essentially um I don't think that I don't think it's sustainable in the long term to have a package ecosystem that's solely from source, and it's for two reasons. Um one is uh a scale. Um as you get up to building it larger and larger scales, um, it's increasingly difficult to build everything from source. Now, of course, for language like Rust, where you know the static analysis is sort of a key a key element of the language, this um uh you know this is of course a challenge. Um but the other piece is um uh closed source code, which uh while I am an open source person and have uh pretty much only worked on open source projects my entire career, including m most of my time at NVIDIA, um uh you know the reality is that closed source is out there. And um I think for Rust to uh uh be truly successful and become a top you know five or a top three language, um it will need to uh uh support um that part of the ecosystem as well. Um and uh you know I think for Rust really to truly to truly become one of those top languages, it's not sufficient to just have all those closed source projects be um uh limited to, oh well, you have to expose your closed source stuff through a C ABI, you know, or or C ⁇ ABI. I think people are gonna want to write things natively in Rust. Um and so that that is that is one thing that I uh I I've said for a few years I would expect Rust to uh uh uh to to evolve on. Um and I'm I'm glad to see that there's now some uh some movement in that direction. So n not not as uh not as fiery of a debate as I was saying before. We're all just like, yeah, this this working on it.

Jane Losare-Lusby

It's like I mean it's a baby project, it's like a long way from like even having anything to show for it yet. But it's it's definitely there's you're not the only person, I think, who wants that. I don't I uh I definitely am much more on the open source side, but so like I have like it's not my priority to to to work on support close support stuff personally. Um though I understand that people want to work that way, I just don't think it's as effective a way to work, but you know, we don't need to get into ideological debate. Um and but yeah, it's it's it's there's definitely plenty of reasons even beyond those like just like binary size, like being able to not have like the same dependency duplicated in every application that uses it, and things like that where it's like Rust needs to be able to do it, and so there's there's no there's no debate there.

Bryce

Yeah. So Jane, do you remember um that we actually met um once before and it I think it was at an LVM?

Jane Losare-Lusby

Yeah, LVM developer meetup 2019, I think.

Bryce

Yeah, that sounds right. Yeah. Uh and I don't I think at the time you were just like starting your your Rust explorations. You weren't like a full convert yet.

Jane Losare-Lusby

No, I was yeah, it was still that was still when I worked at scale, so I was still a professional C developer. I think I was like quite well and deeply into the hyper focus on Rust. Yeah. So I was like, you know, not not necessarily on like on the Libs team or anything like that yet. Um I think I was I think I might have already been on the Clippy team at that point. Um I remember hanging out with Tyler.

Bryce

I think you were because I I seem to recall you um uh talking with great glee about uh clippy. Nice. Yeah.

Jane Losare-Lusby

It was a good time. I I I enjoyed that trip.

Bryce

Alright, kind of, what else should we talk about? There's the the Shinkansen.

Conor

No, no, no. We're not getting we're not getting to that yet. So I recently heard Bjarna Struustrap.

Bryce

I gotta I gotta share something that my girlfriend just texted me. And I gotta disappeared. I just have to pray to God that she never listens to this podcast.

Jane Losare-Lusby

Oh no.

Conor

So um Does this have a backstory? I thought you were just gonna read us a text, my guy.

Bryce

It has a backstory. I'm gonna think of the backstory.

Conor

We have how long is it?

Bryce

Our dog, our dog. Um very smart. Oh my goodness.

Conor

I can't, I'm not airing this. I'm not airing this.

Bryce

I just got a text from the girlfriend.

Conor

This is the worst. Literally, you know, so this is what happened, Jane. Bryce has just gone downhill as a co-host ever since episode zero.

Jane Losare-Lusby

No, no, no.

Bryce

I went, I went, I went up because episode zero, I didn't have a proper microphone. Then I bought the good microphone. So then episode one, that was really where I peaked.

Jane Losare-Lusby

And from there, wait, so when it when you said episode 101, that wasn't like a this is a Vanneginner course. This is like the beginning of the Rust Learning. It was actually the 101st episode.

Conor

That was the 101st episode. Yeah. Did you did you aim that to be Oh no, that was totally an accident. And I'm just realizing now that the we the 101 episode correspond to us trying to learn stuff.

Bryce

That was literally totally you trying to learn something, and me apparently teaching it to you.

Conor

Yeah. But I've been threatening Bryce for like episode 90 to 100 when we had Kate Gregory on uh because Bryce was like eating his dinner and kept on interrupting, and uh, you know, asked Kate a question about the cabin she was in, let her get four words into the question, and then like interrupted her to tell her something about his dog. And I was like, Bryce, what are you doing? And then I said, You're on you're on thin ice. And then I said, I'm gonna start trying out new co-hosts. Then I went and did. I tried out a new co-host, former co-host of CPP Cast, Jason Turner. And then Bryce last week said, uh, because I in I indicated that I might have recorded without him, and then I could just tell Bright Bryce was heartbroken. He was just like, don't record without me. And now here I am being like, you know what? I did the right thing, Bryce. You're back on thin ice. Except this might not even air because people are just gonna be confused on why I'm giving you a hard time, uh, because they won't have heard the story that you just told. Because it's it's inappropriate, Bryce. Clean up your act.

Jane Losare-Lusby

You can just like cut right after he's like, I'm gonna tell you the story, and then just cut to like, we're not airing that.

Conor

All right, back to the question that I had. So this is gonna be we're entering hot take territory. We'll see what we can get out uh from Jane. Recently, on episode uh 155, which really they only started it recording them at like episode 120, of another podcast called C Club. Bjarna Strustrap, they just it's like a Zoom meeting and they just record it. So Bjarna sometimes joins uh creator of the C language, I assume everyone knows that. And at some point in the podcast, it comes, Bjarna ends up saying, I don't even really re remember the lead up to it. They end up making a joke about Rust, saying that, oh, Rust is good because we don't want to get like, you know, downvoted on the internet uh by saying something bad about Rust. And then Bjarna says, Oh yes, the Rust community is much better at propaganda. Than C.

Jane Losare-Lusby

The Rush people are very, very good at uh propaganda. Far, far better than the C crowd.

Conor

And I was a bit confused because I've only been dabbling around in this language for like a week and a bit, and from my experience, it's just better in a lot of ways. That doesn't seem like propaganda to me. That just seems like you got a better story.

Bryce

So I think Bianca is almost certainly referring to what I talked about earlier, which is the memory safety thing. That that um uh how is that propaganda though? Because for whatever reason, I think some people uh of the in the C community feel that um that the memory safety aspect of Rust is nonsense in some way, or that we can achieve the same effect in C or something to that. But but but my my my strong suspicion is that uh what was meant by that is is is a hyper focus on uh on on the the the question of like memory safety. And and I'll prove it to you because almost all of the response from somebody like Vyarna to Rust has been around improving memory safety in C. Like, oh people are concerned about you know this one aspect, like this is the problem. This is the problem with C that it's not a memory safe language, and if we solve that problem, then all of C's problems should be solved. Everything will be perfect.

Conor

What's Jane? Well, Jane, what's your take? And and also to layer on top of the question, because you're inside the Rust community and like part of a couple of the um Rust teams. Is there like inside of Rust, are you aware that people outside of Rust think that you guys have a propaganda machine?

Bryce

Well, okay, okay. This is one one one person, one person.

Conor

I mean, I do get a sense that like a lot of C, especially on slash the subreddit, C subreddit, like they just they don't want to hear anything about Rust. Like they're they're uninterested in what Rust Rust devs and the lessons that Rust people have learned have to share. Um and as like a polyglot that loves all programming languages, including you know some of the most widely hated programming languages like Pearl, I love Pearl. Pearl's great, you know, very similar to Python in a lot of ways that people seem to be refusing to acknowledge. But anyway, so uh I find that kind of just like that just hurting us by doing that. And so I'm just interested, like from like a Rust insider's point of view, is this news to you? Does do people inside the Rust community are they are they aware? And any inside details you could share, I'm sure. I know I would be interested to hear, and some of our listeners, I'm sure.

Jane Losare-Lusby

So there's a meme in the Rust community, and I think you can Google this and see some really beautiful some really funny and hilarious vaporwave art about the Rust evangelism strike force, the RESF. Is this a real thing? Yeah, there's like subreddits to it too. Um so we're definitely very aware of this uh this kind of perception. And I think there's definitely I think Rust has a tendency to get people really excited when they get into it. And so like you won't find people on the project going around and evangelizing aggressively. I think like if you look at like actual project contributors, they're they're they tend to be pretty reserved. I think there I think right now the prevailing attitude is more aligned with your attitude, which is like all the programming languages, like there's not one right way to do things that all the programming languages have value, and we should all be learning from each other. And that but like, especially people, like new people who are really excited, they're they're a lot more likely to be like running around and being like, Have you heard of Rust? And like that that does happen. I mean, and I'm sure that C developers see like other C developers who are learning about Rust coming in and being like, Well, you should have rewritten in Rust, that would have solved this m this one bug you ran into or something. And it's like, you know, not always the most helpful suggestion, and it can be exhausting. And there's definitely, I would say, even like within the project, like a pushback against people like actually engaging in like the Rust evangelism strike force or like rewriting in Rust memes and like kind of supporting that because it can be like a bit counterproductive. And um definitely a preference for kind of mutually supporting other communities and being respectful. Um so we don't we like I don't think there is actively there's there's definitely no active propaganda machine within the Rust project. Like I think there are uh times in the past where we've been a lot better, especially like when we were doing 1.0, I think they were a lot more effective at marketing. I think these days, um there's there's a lot more chaos and we're not as coordinated in that regard. And it's something that we're working on. We like if you if you look on the blog post on the blog, there's like multiple blog posts over the last year about updating Rust governance at the top level, um, which is one of the things I've been involved in and am very excited about. And this is like when you're talking, Bryce, about like getting the effective language evolution, this was like kind of speaking to my heart because like, yeah, I think I understand how important it is to be able to set up an environment where people can collaborate effectively, and it's something that like we struggle with too. Like I know you you feel like Rust has it all like just like really good at the moment. I do think like we're probably in a better spot.

Bryce

The I think the difference is um the at least I'm aware that there have been some problems in Rust evolution and and and leadership um as of late. Um the difference that I see is the willingness to uh address and improve things. Um I don't see that. I'm sorry. The the C Did you say I'm sorry?

Jane Losare-Lusby

Yeah, like like empathizing, not apologizing. That's amazing.

Conor

That's I I thought you like kind of whispered that, and I was like, oh wow, like that was very nice that you're I like I uh that's unfortunate. Um because it is. Thanks for listening. We hope you enjoyed and have a great day.