Steve Klabnik
๐ค SpeakerAppearances Over Time
Podcast Appearances
Well, I just mean, I look at my list and David is here in the audience. I assume just to bask in my fanboying for him. But, you know, I look at my list. There's so many crates that David Tolney has made that I appreciate. And I'm going to kick it off just with one of those because one of the ones that I stumbled on, you know, I write a bunch of macros here and there.
I am frustrated with Rust format. Brian, not in the way that you're frustrated with Rust format, but I want to use it in kind of a library context, and that's challenging to do. Oh, what do you mean? Go on. That's interesting. Well, so I stumbled. I was like, surely David, writer of all macros, has done something for this. And yeah, so there's a crate called Pretty Please.
I am frustrated with Rust format. Brian, not in the way that you're frustrated with Rust format, but I want to use it in kind of a library context, and that's challenging to do. Oh, what do you mean? Go on. That's interesting. Well, so I stumbled. I was like, surely David, writer of all macros, has done something for this. And yeah, so there's a crate called Pretty Please.
And it is for doing rust formatting, like formatting of code. And what I really love about it is it's kind of tersely opinionated. That is to say, look, I'm not trying to be rust format. I'm just trying to make things better, like pretty. Like I'm pretty printing the thing. I'm not formatting the thing. And if you don't like it, well, you know, get out of here.
And it is for doing rust formatting, like formatting of code. And what I really love about it is it's kind of tersely opinionated. That is to say, look, I'm not trying to be rust format. I'm just trying to make things better, like pretty. Like I'm pretty printing the thing. I'm not formatting the thing. And if you don't like it, well, you know, get out of here.
And there are a bunch of like, I think there have been some PRs in issues of the form. Like, could you do it a little bit differently? And I really appreciate that David's kind of like, no, you take it or leave it. If you don't like the way it's formatted, then maybe format it differently. That's fine. But it has been a godsend for a lot of the testing that I've done for these cogeneration crates.
And there are a bunch of like, I think there have been some PRs in issues of the form. Like, could you do it a little bit differently? And I really appreciate that David's kind of like, no, you take it or leave it. If you don't like the way it's formatted, then maybe format it differently. That's fine. But it has been a godsend for a lot of the testing that I've done for these cogeneration crates.
So for example, progenitor, you have like three lines of macro that it poop out like 60,000 lines of code.
So for example, progenitor, you have like three lines of macro that it poop out like 60,000 lines of code.
Well, in particular, when I'm dumping that into a file for test automation or whatever, yeah, I want it to be at least vaguely readable. And I've used Rust format in the past, but there's a bunch of challenges associated with using Rust format in a programmatic context like that. And Pretty Please has been fantastic, exactly what I needed.
Well, in particular, when I'm dumping that into a file for test automation or whatever, yeah, I want it to be at least vaguely readable. And I've used Rust format in the past, but there's a bunch of challenges associated with using Rust format in a programmatic context like that. And Pretty Please has been fantastic, exactly what I needed.
It's going to help you. Yeah. Pretty please. I think exactly what you want in that. Like you mean you, your code generation is like emitting new lines and stuff like that. Yes, that's right.
It's going to help you. Yeah. Pretty please. I think exactly what you want in that. Like you mean you, your code generation is like emitting new lines and stuff like that. Yes, that's right.
Totally. This is what I've fallen in love with, with regard to like Rust macros, which is you can use another David Crate, the quasi-quoting system. So you quote code that looks like Rust code.
Totally. This is what I've fallen in love with, with regard to like Rust macros, which is you can use another David Crate, the quasi-quoting system. So you quote code that looks like Rust code.
and then pretty please we'll just clean it up so you don't have to like just live in this cave person era of like strings on strings and doing your own semi-formatting here and there and the beautiful thing too is like your code generation in macro context can be exactly the same code that if you want to generate code and dump it into files and i think it just allows for
and then pretty please we'll just clean it up so you don't have to like just live in this cave person era of like strings on strings and doing your own semi-formatting here and there and the beautiful thing too is like your code generation in macro context can be exactly the same code that if you want to generate code and dump it into files and i think it just allows for
really, like, debuggable, testable, understandable code, as opposed to, as you're saying, Brian, like, kind of this swirly code generation that is also interspersed with formatting.