We don’t have the concept of primitives, as in those languages, but integer and float are built-in types and decimal is a custom one. So there is a clear demarcation here. In any case, if I could, I would support decimal + integer
, but we can’t do it today without making it slower for all cases and without breaking guard semantics. The shortest way around this is to have decimal
as a native VM type.
Other than that, I am very glad to not have date + 1.days
, because there isn’t anything arithmetic about it. For example, it is not guaranteed that (date + duration) - duration == date
. I do like 1.days
though, as a mechanism to express durations, but I would be 90% as a happy if we had Date.shift(date, months: 1, days: 10)
in Elixir (PRs are welcome, I consider this to be the last calendar feature missing in Elixir).
Finally, the hope is that once we have the type system, we will warn if you give a struct to any >
, >=
, <
, and <=
. It is pretty much a language pitfall that I hope we can address more reliably.