Hacker News new | ask | show | jobs
by neilsimp1 2520 days ago
I have a bit of an off-topic question for anybody who writes Rust.

I'm more familiar with web development and higher level languages, but I've always been interested in Rust. While I know a bit of C/C++, I'm far from an expert. One of the things that turns me off from those languages are the frequent use of really short or cryptic variable/function names.

I'm looking at this codebase, specifically https://github.com/hsiaosiyuan0/naive/blob/master/src/lib/to..., and I see stuff like `let (s, kv, vk, be) = gen_map!`. I have no clue what those variables would be unless I dug around the rest of the file.

Is this sort of variable/method naming convention common in the Rust world? I am not criticizing the author or the language here, merely just curious what I should expect if I dipped my toes into Rust.

1 comments

It depends; Rust is more concise than many languages, but it’s not always that concise. They are in this case because they’re only used once, below the match statement, and are abbreviated forms of the things they’re being assigned to.

Type variables and lifetime names are often only one letter, though.