[BUG]? Timespan>>end

Avi Bryant avi at beta4.com
Mon Feb 23 21:46:42 UTC 2004


On Feb 23, 2004, at 12:21 AM, Brent Pinkney wrote:

> On Mon, 23 Feb 2004 00:11:56 -0800, Avi Bryant <avi at beta4.com> wrote:
>
>> I'm not sure what you're saying here.  Is it that this is 
>> "unexpected" (to a user), but correct behavior?  Or that the behavior 
>> of the code is not what you intended for it to be?
>>
>
> Mmm, basically the english use is ambiguous, if I am correct the 
> mathematical interpretaion/notation of the expression '1pm to 2pm' is 
> [1pm..2pm).
>
> Bacause computer time is discrete and timespan do not overlap, 2pm is 
> not the end of the timespan but the start of the next. The end of the 
> timespan must therefore be one tick (nanoSecond) previous.
>
> The alternative leads to overlapping timespans - a big no no.

I agree with you that what we usually want is an exclusive timespan.  I 
have no problem with 1pm to 2pm not including 2pm, or with some method 
like #last returning 1:59:59.  However, the #end of [1pm..2pm) is 2pm, 
both intuitively and mathematically (time is not discrete, computer or 
no, and you can't properly describe an exclusive range by the last 
value it does include, you need to describe it in the limit of the 
first value it doesn't).  As evidence of the intuition here, you need 
only look at your own class side protocol - #starting:ending: takes as 
its second parameter the first time that is not in the range, not the 
last time that is.  IMO it's dangerously inconsistent to use the word 
"end" in both of those places and give it different meanings.

Avi




More information about the Squeak-dev mailing list