• 1 Post
  • 5 Comments
Joined 2 years ago
cake
Cake day: June 15th, 2023

help-circle



  • I think some of the modern languages handle this pretty well. Rust has algebraic data types thanks to its brilliant use of enums. Go has a similar type system. Taking the elapsedTime example from the post, for solving this duration related problem, a Rust programmer would use Duration::from_millis(millis) or Duration::from_secs(secs) and forget about the unit. It’s a duration, that’s what you wanna care about.