Hacker News new | ask | show | jobs
by Waterluvian 1215 days ago
Today I had a moment with TypeScript where I got an error because a class property wasn’t definitely initialized in the constructor.

I thought, “I wish there was a way to prove to the compiler that it will be there when I access it, rather than having to tell it to trust me.”

And that’s when lifetimes in Rust really clicked for me. I know it’s not exactly the same thing but the value of describing the valid lifetime of a thing at compile time began making a lot more sense.