Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
craftit
· 2y ago · 0 comments
It saves writing lots of boilerplate. If you implement it for a type, you automatically get: <, >, <=, >=, ==, !=
Comments
[–]
mysterydip
2y ago
Ah that makes sense, thanks! Then you can just do normal comparisons on the integer value of < > or == to 0.
[–]
wkennington
2y ago
It also makes implementing all those operators easier for similar objects as you don’t need to plumb 6 different routines.