Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's non-obvious to me what 2.days() returns, that's the problem.


I 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.


Yeah, 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.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: