[squeak-dev] Date hash is broken

Chris Muller asqueaker at gmail.com
Wed Oct 17 18:03:35 UTC 2018


> > DateAndTime now relates to a particular timezone, Date today does not.

Sorry, above ^^ I meant they are actually different magnitudes, not
just different types.

> Yet, the following must hold:
>
>         (a = b) ==> (a hash = b hash)

Woops!  I didn't notice the last line comparing the hashes!  That IS a problem.

This is a case where "browse origin" comes in handy.   It appears we
broke it in this series of packages:

__________________________
Name: Kernel-bf.991
Author: bf
Time: 17 February 2016, 6:33:53.746681 pm
UUID: 1d2c150b-bafd-43be-a1ea-648007f13215
Ancestors: Kernel-dtl.990

Use proper timezone in DateAndTime now.
__________________________
Name: Kernel-bf.994
Author: bf
Time: 18 February 2016, 2:59:01.974843 pm
UUID: e47a7687-8244-43f0-b608-3f0759ac382d
Ancestors: Kernel-eem.993

Make Timespan explicitly ignore its start's timezone offset if it was
created with the defaultOffset.
__________________________
Name: Chronology-Core-cmm.3
Author: cmm
Time: 18 March 2016, 1:31:09.337847 pm
UUID: 4e36f7ad-aa95-433a-bb7f-198798b81942
Ancestors: Chronology-Core-cmm.2

- When the localTimeZone is explicitly updated by the user, ensure the
system does not silently change it back if the user didn't remember to
also turn off automaticTimeZone:.
- Added DateAndTime class>>#nowAtOffset: to obtain the local time at
other places than the localTimeZone.
__________________________
__________________________
__________________________

Oh boy, I remember this...   after all that battling we did... to come
out with a bug like this.   Sad...

Yeah, we gotta get this fixed.

Folks, for something like this I request that we please start our
solutions out in the Inbox please.  Thanks for your understanding.

Best,
  Chris
>
> Best regards
>         -Tobas
>
> >
> > Please read the class comment of both Date and DateAndTime.
> > On Wed, Oct 17, 2018 at 9:36 AM Chris Cunningham
> > <cunningham.cb at gmail.com> wrote:
> >>
> >> Hi.
> >>
> >> Following a thread in Pharo where two dates that are equal weren't usable in a Dictionary as keys, I wondered if the same thing is true in Squeak.  It is, unfortunately.  I can't use the same code as given in the Pharo example (we don't have a #translateToUTC), but equivalent code shows the issue:
> >>
> >> d1 := DateAndTime now asDate.
> >> d2 := Date today.
> >> d1 = d2. "true"
> >> d1 hash = d2 hash. "false"
> >>
> >> I'll get around to fixing the hash in the next day or so, when I get a chance to figure out how.
> >>
> >> Thanks,
> >> cbc
> >>
> >
>
>


More information about the Squeak-dev mailing list