On the 1st day at the Recurse Center, they asked the room of new Recursers what they’re excited about & what they’re nervous about. One of the faculty, writing down on a whiteboard what the room came up with, suggested that we just shout out our ideas. Immediately, I yelled “Rust!” They asked, “excited or nervous!?”
I am excited about Rust!
I had some pretty good ideas coming into this batch about what I was hoping to accomplish during my time here. I’d like to try to give weekly updates on my progress to track what I’ve done & see about getting feedback about how to move forward on my goals.
One of my major technical goals is to become a contributor to the Rust compiler before the end of this batch.
I started the day by reviewing a blog by Eliza Weisman, that’s currently unpublished. I moved onto reading Michael Snoyman’s Rust Crash Course blog series. I mentioned to Michael that it’s possible to recover from panics towards the end of the day & by posting that, started a little bit of a discussion about unwinding panics across FFI boundaries explaining why Firefox treats its panics as aborts.
I also volunteered to pick up an issue on x25519-dalek! I’m really excited about this project because I don’t know a lot about cryptography & I want to learn more. I paired with a couple of folks on this at RC so far & it’s been really fun. While the issue didn’t really require that I understand how the Diffie-Hellman (DH) key exchange works, I looked into it a bit. I learned that DH is one of the earliest practical public key exchanges implemented in cryptography. The goal is to establish a shared secret key based on public keys by combining ephemeral (short time) secret keys with public keys & using a symmetric key cipher algorithm. The issue specifically was to change a few [u8; 32]
values to have the custom types of Ephemeral
& SharedSecret
in order to implement the Drop
trait & clear the contents of those values when they are being dropped. You want to clear the contents of the values in the event that some other process gets the contents of your memory & your SharedSecret
or Ephemeral
keys aren’t so secret anymore!
I pretty quickly got the tests in the source file to work, but I broke the doctests. So, I decided to sidetrack & look more into how doctests work. Specifically, I was curious about how the tests were generated from the documentation. I read QuietMisdreavus’s blog post on how doctests are created by rustdoc & that answered all my questions.
After finishing that I moved onto the actual error message I got after I broke the doctests:
---- src/lib.rs - (line 55) stdout ----
error[E0432]: unresolved import `x25519_dalek::generate_secret`
--> src/lib.rs:60:5
|
6 | use x25519_dalek::generate_secret;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `generate_secret` in the root
One of the changes for this issue was to add a type for keys & move the functions associated with it into the type (aka create methods). When you create a new type you import it by saying
use x25519_dalek::Ephemeral;
This imports all the functions for the type & then to call it you prefix the function with the type like this:
Ephemeral::generate_secret()
I was also wrote some impl Type
blocks for this PR. I concretely learned about how & when to use the self
& Self
keywords. Writing out the code for the type implementations a few times made it so the pattern is now in my head. I learned how to run benchmarks in Rust with Cargo using cargo +nightly bench
. There’s a lot more to say about everything I learned on this issue & it might be good for another blog post.
I also committed to collaborating on an XML parsing crate & I grabbed an issue to work on for the rustwasm project, where I hope to be a more consistent contributor. I’m really excited to be contributing more to open source Rust software & potentially becoming a maintainer of a crate!
I did a lot of learning around translating my Haskell speak, that I usually use for talking about Rust with my Rust friends, into actual Rust language terms. If you hang out with someone long enough that speaks the language you’re trying to learn, the words will creep into your vocabulary. I’ve been slowly picking it up for months, but this week I was much more intentional about learning & using Rust terminology. I also did a lot more thinking around memory & resource management in Rust. Coming from learning Haskell for the last year & a half, a language that is garbage collected, it’s been a strange switch to Rust. It’s not exactly completely manual memory management, but it’s also not what people think of when they think of garbage collection. Steve Klabnik’s blog post on static garbage collection really made this concept easier to understand for me. I’m thinking about writing a post about switching back to thinking about memory & resource allocation by running through the implementation for drop
.
I also got the opportunity to look at other people’s Rust work! I saw the start of an HTML parsing crate, that I hope is published, with the larger intent of understanding how web browsers work by creating one. I also saw a working CLI email client in Rust!
This week has been a whirlwind of events. I’ve been in New York City for a whole week now! I went from tripping over myself & getting lost in the subway tunnels to confidently navigating the city. I’ve made new friends at RC, met a few online friends for the first time, & caught up with old friends that moved here. I’ve learned a lot on CS topics I haven’t mentioned here that I knew nothing about! I had lots of conversation unrelated to computers on various interesting topics.
A lot of my time has been spent at the Recurse Center this week (probably to an unhealthy extent, considering I’ve been here about 12 hours each day & I have an hour commute each way). I don’t want to glorify the overwork that I’ve done. I want to be cognizant of it & make a plan to do better. I don’t want to celebrate the “achievement” of productivity that comes at the cost of self care. A goal that I have for next week is to go walk in the middle of the day, everyday. I want to take more breaks from the work I want to get done so I have more time to pair with people on their projects & get to have more conversations & form relationships with people because the people here have been so amazing & kind & that’s how I’ll learn even more cool things!
The friendliness of this space, this feeling of being welcome, isn’t something I experience on a regular basis in programming spaces. The last time I felt this way I was at Rust Belt Rust. The other times major times were at ICFP & RustConf this year. That’s been about it. I usually feel uncomfortable, even when people try to make their spaces welcoming. It makes it hard to ask questions when I feel like I’m already on the edge of belonging anyway. Those negative feelings make it hard to write code & interact with people in order to become a better programmer. The social rules that RC has to foster a positive environment help. The interview process & the intentional inclusion of people is also an important factor as to why this place & the people are as friendly as they are. It’s harder to create those sorts of spaces in less selective places, like meetup groups or conferences or work, where those characteristics may not be taken into account. But I don’t think that creating those spaces always needs to be the goal. It’s fine for other spaces to prioritize other goals.
That being said though, Rust’s code of conduct is definitely a big part of the reason why I like being involved with this technical space & why I am intentionally choosing to spend more time on Rust. If your priorities are making sure that people feel comfortable, & you loudly state that & follow through, people will also self select to be part of your community if that’s a priority to them. The interview process for RC is a big part of why I feel so fortunate & so humbled that I could come here. This space has allowed me to focus all of my energy on writing code & talking to people that are happy to teach me things in the kindest way possible. It’s so easy to stay here for long hours because I want to soak in this energy & never let it go. I’ve had the most pleasant experiences pairing with so many people on Rust this week in person. I hope to continue my work with Rust & treat everyone with the thoughtfulness that they need to focus on their work & accomplish their goals.