Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
taurknaut
· 1y ago · 0 comments
This doesn't strike me as that different than an enum.
Comments
[–]
MathMonkeyMan
1y ago
Arithmetic is defined on range types. So day 30 + day 4 is 34, which if you then try to coerce into a day will throw an exception.
[–]
dragonwriter
1y ago
And... So? It seems you are saying Day_type + Integer is Integer, and Integer (in general) cannot safely be coerced into Day_type and... that’s logically correct?
[–]
MathMonkeyMan
1y ago
`Day_type + Day_type` is also defined, and it overflows. That's like normal integers, and unlike enums.