Chris Cunningham uploaded a new version of Chronology-Core to project The Inbox:
http://source.squeak.org/inbox/Chronology-Core-cbc.45.mcz ==================== Summary ==================== Name: Chronology-Core-cbc.45 Author: cbc Time: 14 May 2019, 3:33:13.333275 pm UUID: 4117cd16-a46a-4647-9630-49ee93d3f725 Ancestors: Chronology-Core-nice.44 With the UTC / DateAndTime changs, DateAndTime>>utcOffset: changed to update the existing instance in place instead of creating a new instance. The change fixes #asLocal to create a new instance, bypassing #utcOffset:. Follows the same logic as used in #asUTC =============== Diff against Chronology-Core-nice.44 =============== Item was changed: ----- Method: DateAndTime>>asLocal (in category 'ansi protocol') ----- asLocal + "Anwer a copy of oursielves (if necessary) in the local timezone. #utcOffset: now modifies my instance, so the creation of the new instance should happen here." - ^ (self offset = self class localOffset) - ifTrue: [self] + ifFalse: [self copy localOffsetSeconds: self class localOffset asSeconds]! - ifFalse: [self utcOffset: self class localOffset]! |
Apparently I use this, but not where I run into it every day. And there are test to make sure #asLocal works - but they involve having aDateAndTime set, then comparing aDateAndTime asLocal = aDateAndTime, which obviously works. Since the previous code actually changed aDateAndTime, the two are identical (as opposed to just equivalent). If no one objects, I'll move this into trunk in a couple of days. -cbc On Tue, May 14, 2019 at 3:33 PM <[hidden email]> wrote: Chris Cunningham uploaded a new version of Chronology-Core to project The Inbox: |
+1
The original code answered a new instance if and only if the offset of aDateAndTime was different from DateAndTime class>>localOffset, whatever that might happen to be. The method name #asLocal implies that it should (consistently) answer a new instance. That sounds more correct to me, so as long as the tests still pass and nothing else is broken, please move it to trunk. Dave On Tue, May 14, 2019 at 03:38:28PM -0700, Chris Cunningham wrote: > Apparently I use this, but not where I run into it every day. > > And there are test to make sure #asLocal works - but they involve having > aDateAndTime set, then comparing aDateAndTime asLocal = aDateAndTime, which > obviously works. Since the previous code actually changed aDateAndTime, > the two are identical (as opposed to just equivalent). > > If no one objects, I'll move this into trunk in a couple of days. > > -cbc > > On Tue, May 14, 2019 at 3:33 PM <[hidden email]> wrote: > > > Chris Cunningham uploaded a new version of Chronology-Core to project The > > Inbox: > > http://source.squeak.org/inbox/Chronology-Core-cbc.45.mcz > > > > ==================== Summary ==================== > > > > Name: Chronology-Core-cbc.45 > > Author: cbc > > Time: 14 May 2019, 3:33:13.333275 pm > > UUID: 4117cd16-a46a-4647-9630-49ee93d3f725 > > Ancestors: Chronology-Core-nice.44 > > > > With the UTC / DateAndTime changs, DateAndTime>>utcOffset: changed to > > update the existing instance in place instead of creating a new instance. > > The change fixes #asLocal to create a new instance, bypassing #utcOffset:. > > Follows the same logic as used in #asUTC > > > > =============== Diff against Chronology-Core-nice.44 =============== > > > > Item was changed: > > ----- Method: DateAndTime>>asLocal (in category 'ansi protocol') ----- > > asLocal > > + "Anwer a copy of oursielves (if necessary) in the local timezone. > > #utcOffset: now modifies my instance, so the creation of the new instance > > should happen here." > > - > > > > ^ (self offset = self class localOffset) > > - > > ifTrue: [self] > > + ifFalse: [self copy localOffsetSeconds: self class > > localOffset asSeconds]! > > - ifFalse: [self utcOffset: self class localOffset]! > > > > > > > |
Chris, I'm sure its fine but still interested in taking a look but
can't get to it tonight. On Tue, May 14, 2019 at 7:32 PM David T. Lewis <[hidden email]> wrote: > > +1 > > The original code answered a new instance if and only if the offset > of aDateAndTime was different from DateAndTime class>>localOffset, > whatever that might happen to be. The method name #asLocal implies > that it should (consistently) answer a new instance. That sounds > more correct to me, so as long as the tests still pass and nothing > else is broken, please move it to trunk. > > Dave > > On Tue, May 14, 2019 at 03:38:28PM -0700, Chris Cunningham wrote: > > Apparently I use this, but not where I run into it every day. > > > > And there are test to make sure #asLocal works - but they involve having > > aDateAndTime set, then comparing aDateAndTime asLocal = aDateAndTime, which > > obviously works. Since the previous code actually changed aDateAndTime, > > the two are identical (as opposed to just equivalent). > > > > If no one objects, I'll move this into trunk in a couple of days. > > > > -cbc > > > > On Tue, May 14, 2019 at 3:33 PM <[hidden email]> wrote: > > > > > Chris Cunningham uploaded a new version of Chronology-Core to project The > > > Inbox: > > > http://source.squeak.org/inbox/Chronology-Core-cbc.45.mcz > > > > > > ==================== Summary ==================== > > > > > > Name: Chronology-Core-cbc.45 > > > Author: cbc > > > Time: 14 May 2019, 3:33:13.333275 pm > > > UUID: 4117cd16-a46a-4647-9630-49ee93d3f725 > > > Ancestors: Chronology-Core-nice.44 > > > > > > With the UTC / DateAndTime changs, DateAndTime>>utcOffset: changed to > > > update the existing instance in place instead of creating a new instance. > > > The change fixes #asLocal to create a new instance, bypassing #utcOffset:. > > > Follows the same logic as used in #asUTC > > > > > > =============== Diff against Chronology-Core-nice.44 =============== > > > > > > Item was changed: > > > ----- Method: DateAndTime>>asLocal (in category 'ansi protocol') ----- > > > asLocal > > > + "Anwer a copy of oursielves (if necessary) in the local timezone. > > > #utcOffset: now modifies my instance, so the creation of the new instance > > > should happen here." > > > - > > > > > > ^ (self offset = self class localOffset) > > > - > > > ifTrue: [self] > > > + ifFalse: [self copy localOffsetSeconds: self class > > > localOffset asSeconds]! > > > - ifFalse: [self utcOffset: self class localOffset]! > > > > > > > > > > > > > > |
On Tue, May 14, 2019 at 6:52 PM Chris Muller <[hidden email]> wrote: Chris, I'm sure its fine but still interested in taking a look but Ok, will wait.
The test still pass. And the only senders of this method in the base image is the tests testing it. Thanks, cbc |
Free forum by Nabble | Edit this page |