Hacker News new | ask | show | jobs
by adkadskhj 2002 days ago
Match has it's place in unpacking common Enum types like Option and Result, but typically you'll reach for functional patterns like `Result::map`, `Result::expect`, `Result::unwrap_or`, and of course `?` as they're able to do the same thing but in far less code.

I think the downvotes are because both the example and the generalized statement that C# is "noticeably faster" is bait / lazy.

2 comments

The railway error-handling paradigm is superior (in my mind) to the common try/catch/throw pattern in many other languages. It promotes errors to first class citizens. It's a monadic pattern that many functional programmers like to employ.
Definitely not bait because I like to jump around with languages so it's natural for me to compare them (that's why I do it.) I wrote my web server in Go, my util to find duplicate directories in Rust, etc.. I wasn't saying C# is faster than Rust, I said C# got faster.
> I wasn't saying C# is faster than Rust, I said C# got faster.

Ah gotcha - my mistake :)