10 ms·
I feel the same way that hamburgler does. For me at least, you java calendar code looks horrible. I'm thinking something more like date.today() - timedelta
by MichaelSalib 13y ago
I feel the same way that hamburgler does. For me at least, you java calendar code looks horrible. I'm thinking something more like
date.today() - timedelta(days=2)
- matthewmacleod 13y agoNote that this syntax is perfectly achievable in Ruby (w/ActiveSupport) too. The following expressions are equivalent: Time.now - 2.days Time.now.advance(days: -2)
- MichaelSalib 13y agoIf you can get exactly the same benefit, then why pay the cost of overriding behavior of the integer type and dealing with hidden black magic that makes your program harder to reason about?
- steveklabnik 13y agoI'm not sure which example you're talking about, but there's no additional cost in the Rust example. And it's not hidden; it's in the trait definition, which is scoped.