3 ms·
I don't mind the aforementioned abbrevations, but I think certain choices — "fn" in particular — make poor "visual anchors". Rust generally suffers from a Perl
by atombender 10y ago
I don't mind the aforementioned abbrevations, but I think certain choices — "fn" in particular — make poor "visual anchors".
Rust generally suffers from a Perl-like visual clutter, caused by a proliferation of punctuation (I have a particular hatred for "::") and also the unfortunate choice of snake_case for identifiers. Some of these things work in Ruby and Python because they're otherwise very uncluttered languages, but in Rust they only exacerbate the noisiness. (As a minor aside, it's always bothered me that almost all snakecase languages don't Capitalize_Like_This, so they're not symmetrical here. Oh, well.)
The Rust devs always bite back when I complain about the above. I know they put a lot of thought into it; I just think they could have put in more. The visual aspect of code is almost always underestimated by language designers.
(On a semi-related note, I really like how Facebook's Reason cleans up OCaml's syntax.)
- lomnakkus 10y agoI think the choice of snake_case may be somewhat supported by empirical research[1, 2]. (The first link is a summary of the study.) No idea if the Rust designers knew of this study. [1] https://whathecode.wordpress.com/2013/02/16/camelcase-vs-underscores-revisited/ https://whathecode.wordpress.com/2013/02/16/camelcase-vs-und... [2] www.cs.kent.edu/~jmaletic/papers/ICPC2010-CamelCaseUnderScoreClouds.pdf
- atombender 10y agoInteresting, thanks. Those studies seem to look at readability in isolation, but in my opinion the readability problem emergeces when combined with many other sources of "noise". Snakecase works perfectly fine in less noisy languages like Ruby and Python where there's little clutter in the first place. In a noisier language like Rust, camelcase would have helped give it more visual cohesiveness. That said, I'd love a programming font that could actually align the underscore with the font baseline. In all of today's fonts, the underscore breaks up the identifier into little pieces. Compare the vertical cohesiveness (not perfect, but closer) of: an⎽underscore⎽identifier with: an_underscore_identifier