When writing the following today in C#
DateTime.Now.AddYears(-60)
I wondered whether there are any languages that allow a more natural syntax with units:
DateTime.Now - 60years
Does anyone know of any? Specifically, I'm interested in the presence of unit operators(?) that turn "60years" into e.g. "TimeSpan.FromYears(60)". It'd also be neat to be able to define your own unit operators, similar to how you can write conversion operators in C#
(Yes, I know TimeSpan doesn't cater for years -- it's an example.)