Hacker News new | ask | show | jobs
by fjrieiekd 3447 days ago
In fairness, it's harder to learn Rust as one has to be aware of when and when not to put semi-colons, otherwise the compiler chokes with an unhelpful error. It also looks very weird to see a trailing value just hanging at the end of a long function.

I much prefer the decisions Swift made in this area, with no semicolons and implicit returns only for short functions.

This isn't to knock Rust or the work that you guys do, just a part of the language that can be learned, but does impose a speed bump during that learning process.

1 comments

I mean, yeah, but you can say the exact same thing about braces in C. Rust lets you use explicit return all the time (with semicolons everywhere), if you want to. C lets you use explicit braces all the time, if you want to.

Rust also lets you use expression returns by omitting semicolons, which is a common programming style. C also lets you omit braces, which is a common programming style. Being common programming styles, you have to deal with them often. Both are a bit confusing to wrap your head around at first. I find that Rust's confusingness is fine because you can't goof up with it; the compiler will error if you do. C on the other hand will happily let you mess up your braces and still compile.

Again, this is different, not worse.