Always use [closed, open) intervals
1–10 of 169 posts
Re: Always use [closed, open) intervals
#2To add some nuance I'd say that if you're dividing a larger interval into smaller subintervals then a half-open one is probably what you want.
Re: Always use [closed, open) intervals
#3Re: Always use [closed, open) intervals
#4This is just a rambling, absolutist mess.
Re: Always use [closed, open) intervals
#5Users are used to selecting a daterange in closed closed format for example.
Re: Always use [closed, open) intervals
#6There are convincing cases one can make in favour of half-open intervals (at least in certain circumstances), but this isn’t it. This is just a rambling, absolutist mess.
Re: Always use [closed, open) intervals
#7This depends on use case. If you are doing a frontend layer on top of closed-open, then the frontend will have to handle the points the article is rambling about. Users are used to selecting a daterange in closed closed format for example.
Though from a user perspective, they are still there on the final day. Still, I think there's some nuance to this, as it's generally understood the date range they select isn't the number of nights they expect to pay for.
Re: Always use [closed, open) intervals
#8Re: Always use [closed, open) intervals
#9Case in point, last week I worked with list ofdates, and I needed the last date to bracket my sliding windows as a time period cleanly.
Re: Always use [closed, open) intervals
#10I think this advice could be better summed up into: to minimise off-by-one errors, choose a consistent strategy for describing intervals, and stick with it as much as is sensible.