the.bay.news

A proposal to introduce .russian_roulette() and .dying_words() as explicit method aliases for .unwrap() and .expect() to clearly convey their potential for runtime crashes

Rust Internals
A proposal to introduce .russian_roulette() and .dying_words() as explicit method aliases for .unwrap() and .expect() to clearly convey their potential for runtime crashes
Hi all, I would like to propose a zero-cost, fully backward-compatible API enhancement to Option and Result: introducing explicit method aliases for .unwrap() and .expect(). Motivation: The terms unwrap() and expect() are far too generic for how dangerous they actually are. Because these names sound completely benign and ordinary, newcomers frequently misuse them in production code without realizing they can trigger runtime crashes (panics). To improve mental models and code readability, I pr...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.