<div dir="ltr">I like this.<div><br></div><div>Although I notice that the comparison makes sure that the classes are the same - so a Timespan starting at the exact same time as a Date and with 24 hour duration is not the same as a Date with the exact same values.</div><div><br></div><div>This would allow further speedups if Date, Week, Month, and Year if we wanted - just drop the comparison of duration in those classes.  (The general case is still needed to tell Timespan apart from Schedule.)</div><div><br></div><div>If you did that, you probably also want to re-implement hash as well - simplifying it the same way.</div><div><br></div><div>-cbc</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Oct 17, 2018 at 8:07 PM <<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Chris Muller uploaded a new version of Chronology-Core to project The Inbox:<br>
<a href="http://source.squeak.org/inbox/Chronology-Core-cmm.14.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/inbox/Chronology-Core-cmm.14.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Chronology-Core-cmm.14<br>
Author: cmm<br>
Time: 17 October 2018, 10:07:14.485014 pm<br>
UUID: 5d93900c-4a4e-4a4e-80f3-800dbdb07d0b<br>
Ancestors: Chronology-Core-tcj.12<br>
<br>
- A fix and optimization of Timespan>>#=.  Both elements being compared must have the same timezone (or same state of #noTimezone) in order to take advantage of the optimized #hasEqualTicks: comparison.  Otherwise (if different timezones), a full comparison of their starts (via #=) is needed.<br>
- There was a mention of this optimization put into the class comment.  This level of detail may be a bit tedious for users to read at that level, so Brents original comment was restored.<br>
<br>
=============== Diff against Chronology-Core-tcj.12 ===============<br>
<br>
Item was changed:<br>
  Magnitude subclass: #Timespan<br>
        instanceVariableNames: 'start duration'<br>
        classVariableNames: ''<br>
        poolDictionaries: ''<br>
        category: 'Chronology-Core'!<br>
<br>
+ !Timespan commentStamp: 'cmm 10/17/2018 22:00' prior: 0!<br>
+ I represent a duration starting on a specific DateAndTime.!<br>
- !Timespan commentStamp: 'bf 2/18/2016 14:43' prior: 0!<br>
- I represent a duration starting on a specific DateAndTime.<br>
- <br>
- If my start has an offset identical to my #defaultOffset then comparisons ignore timezone offset.!<br>
<br>
Item was changed:<br>
  ----- Method: Timespan>>= (in category 'ansi protocol') -----<br>
  = comparand<br>
+     ^ self class = comparand class <br>
+         and: [(((self noTimezone and: [comparand noTimezone]) or: [self start offset = comparand start offset])<br>
+             ifTrue: [ self start hasEqualTicks: comparand start ]<br>
+             ifFalse: [ self start = comparand start ])<br>
+         and: [ self duration = comparand duration ] ]<br>
-       ^ self class = comparand class <br>
-               and: [((self noTimezone or: [ comparand noTimezone ])<br>
-                       ifTrue: [ self start hasEqualTicks: comparand start ]<br>
-                       ifFalse: [ self start = comparand start ])<br>
-               and: [ self duration = comparand duration ] ]<br>
  .!<br>
<br>
<br>
</blockquote></div>