4 ms·
This must be a question of aesthetics because the 2.days().from_now() seems perfectly obvious to me. Maybe someone can help me understand why it seems confusing
by wycats 13y ago
This must be a question of aesthetics because the 2.days().from_now() seems perfectly obvious to me. Maybe someone can help me understand why it seems confusing?
- Touche 13y agoIt's non-obvious to me what 2.days() returns, that's the problem.
- matthewmacleod 13y agoI don't think that's a problem: avoiding features or fiddling with syntax in order to make the code more accessible to people who are not familiar with the language or its libraries isn't going to gain much in the long run. Languages and libraries should be geared towards long-term developer happiness, rather than a shallow learning curve. Anyway, I know as close as possible to nothing about Rust. It seems blindingly obvious to me that `2.days()` returns some kind of duration, and `2.days().from_now()` returns some kind of time. So I've looked at the code, and that appears to be correct - `2.days()` returns a `TimeChange`, and `2.days().from_now()` returns a Time. I can't think of any other reasonable interpretation.
- ivanca 13y agoYeah, you _had_ to look at the code to realize that; when it could have been new TimeChange.fromString("2 days from now") Which would have been more helpful for actual development, not only for a dumbed-down syntax aiming for easier comprehension.