3 ms·
Many of these are not possible due to backwards compatibility. Even if we could: 1. Most Rust users, including me, like the implicit returns. We would face a t
by pcwalton 10y ago
Many of these are not possible due to backwards compatibility. Even if we could:
1. Most Rust users, including me, like the implicit returns. We would face a ton of pushback if we tried to drop them. Rust doesn't actually need that many semicolons: you can frequently leave them off.
2. This is tricky, because it can have surprising semantics if not done right (e.g. right shifts). There are proposals to do something like this, though.
3. I disagree. That would eliminate much of the benefit of ? to begin with.
4. Not possible. This would complicate the already very complex typechecker too much.
5. Macros 2.0 is coming. We can't just remove macros: they're fundamental to basic things like #[derive] and string formatting.
- fjrieiekd 10y agoHi pcwalton, 1) If you dropped semicolons like Swift, you could keep implicit returns. I just don't see the advantage of having them in multiline functions at the cost of having to retain semicolons. IMO, a trailing value after a multiline function also just looks plain bizarre for newbies. I agree it's probably too late for this, but you asked how Rust could be easier to learn and this is one of the ways. 2) It would certainly be much nicer to have this. 3) See Swift for an example of where this was done more nicely IMO than in Rust. 4) Unfortunate. Splitting out a helper function means we lose Rust's inference which already exists when used in a let statement, and requires adding dependent crates from libraries to the binary's Cargo.toml and importing them into the module and hard coding the types. The client shouldn't have to care about this. 5) Great! I still enjoy the language just the same, but you asked how it can be easier to learn and this is how I see it.