06 Jan 2020

The benefit of no legacy

I’m wrangling some job automation via email, again. I decided to do this in Rust, although part of me was wondering why bother?

I’ve already written something close enough in Scala, using a tried and tested Java library that I know well enough to dig myself out of most holes. To add to the doubt, the Rust parsing library has this warning in the README:

“This is written by a newbie Rust programmer, so code may be non-idiomatic or suboptimal.”

Fair enough. I still gave it a go. It’s a small amount of code, and the learning will be useful.

Perhaps under the hood the library lacking (I’ve not looked; I don’t know). But from a user point of view, it’s written the way I need it to be. I mean, it uses Option to signal values that might be missing; it uses Result to type errors, using a nice ADT. I can map and and_then over values.

I assume that’s the benefit of Rust having no real legacy. It’s not a platform from a time when nulls and exception throwing was the norm. It means a self-declared newbie is led by idiom to build a library that’s reasonable to use.

Long may it last.