| > even you must admit that Rust has gotten less 'functional' in nature as time goes on. I don't think this is true, especially when you look at long timescales. > New syntax or ad-hoc abstractions are being created to handle problems that have well known FP solutions. They have known solutions when you have a GC and no control over memory layout. They do not have known solutions in a language like Rust. > Take this matching on an Option business. The easy solution is to just add a fold method on the option type. Problem solved, now you never will need to match an option ever again! Sorry, I do not understand what you're talking about. (I coded in Haskell most a decade ago, I'm not on the lang team.) What would fold do on an option, specifically? Fold is usually a list operation, but an option is a list of zero or one... so it would be a no-op? > The harder solution would be to implement HKT and add a real monad trait, but let's not get into that Again, this is "we don't know if this is possible in a language like Rust" territory. Which is why you don't want to get into that. > Another example are the async/await syntax. Why does this syntax need to exist? Specifically because of the previous statement. It is not clear that a more abstract option is possible. We could wait for more years until maybe it's proven possible, or we could implement a useful feature today that we know is. It's also more significant in Rust than other languages due to borrowing. http://aturon.github.io/tech/2018/04/24/async-borrowing/ is a bit out of date but the concept is the same. > Why can't a future just be a regular old class? Rust doesn't have classes. Futures are a regular old typeclass. > While it still is undoubtedly innovative, it seems like the target audience has shrunk considerably. We have seen a massive uptick in adoption over the past few years. async/await, for example, has been a feature that a lot of folks have said "I'll start using Rust once that hits stable." |
Presumably the fold takes advantage of the fact that the default, "accumulator" value is chosen if the Option is empty and the collapse function just runs what would be the Some arm of the match statement.