|
|
|
|
|
by bjz_
4376 days ago
|
|
I thought it was crazy at first, but `;` operator as a statement separator that returns `()`, and an implicit return at the end of a block greatly reduces the need for mutable temporaries and leads to a more functional code style. This is a real win when it comes to code maintenance. I greatly miss it when shifting back to other more statement-driven languages. I would encourage you to try it! > This is like optimising for the least readable code possible. I imagine it's going to be a nightmare in practise. I have pushed a reasonable amount of code to the rust repo, my own libraries, and some to servo, and it has never been an issue, in fact it has been the opposite (proof: https://www.ohloh.net/accounts/bjz and https://github.com/bjz/). > What I do care about is being able to tell exactly what some code does by glancing at it, without worrying too much about whether someone wrote = instead of ==. Rust solves this by having assignment expressions always returning `()` from assignment expressions and not having implicit conversions. The issues with `==` vs `=` completely vanish. |
|