this post was submitted on 04 Apr 2024
369 points (95.8% liked)

Programmer Humor

32410 readers
962 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 4 points 7 months ago* (last edited 7 months ago) (1 children)

That said, with how few expressions are return values, I do wonder why semicolons are the default rather than adding a special character to indicate return values.

you mean like return/break/etc.?

because Rust was designed to remind you of functional programming despite not being very functional, and because semicolons allow way better syntax rules in Rust and are generally pretty vital for good, readable lowish-level code. it also allows Rust programmers to use newlines/indents and stuff to pretty up their code a lot without littering it with random \ and |> and begin end and such everywhere, which, given how dense Rust code can be and how much it uses iterators and weird trait magic, is a big plus for readability