Hacker News new | ask | show | jobs
by AlleyTrotter 2545 days ago
Can someone point to a explanation of how to speak/read Rust. exactly how would you say "use std::fs::File" How does one pronounce :: Seems simple enough but things get much more complex by the third or fourth chapter of the Book.
2 comments

I would just read the words, "use" "standard" "fs" "file" and wouldn't pronounce the "::" at all.
so the " :: ' has no verbal meaning, it's just a way of linking traits, libraries, functions,or crates? Not easy to explain
It's for dereferencing namespaces. "a::b::c" is analogous to a file system path /a/b/c.
I found what I was looking for in the appendix

B-3 Path related syntax """ ::path Path relative to the crate root (i.e., an explicitly absolute """

std pronounced "stud" with a very very short "u".
I never pronounce separators like ::, ., ->... And braces, brackets, parenthesis and angle braces I do not pronounce. Programming languages are made not to sing them, but to write and read. To read silently I mean. While I understand what I'm reading, I do not bother to pronounce it in a way that would be digestible by an accident listener.

If such a strategy stands between you and understanding, I'd suggest you to use silence gaps of different lengths. Like 0.5s for space and 0.2s for ::.

you don't pronounce "->" as returns even in your thoughts?
I used above -> in a C++ sense, but I tried it watching myself with Rust, and seems that I do not pronounce ->. I pronounce just identifiers, keeping track of the context (and therefore the semantics of identifiers) by other means.