[squeak-dev] Date hash is broken
Tobias Pape
Das.Linux at gmx.de
Wed Oct 17 16:43:49 UTC 2018
> On 17.10.2018, at 18:40, Chris Muller <asqueaker at gmail.com> wrote:
>
> Nothing is broken in that example. They are truly different.
>
> DateAndTime now relates to a particular timezone, Date today does not.
Yet, the following must hold:
(a = b) ==> (a hash = b hash)
We need to change something.
Maybe we need #isSameDayAs: instead of =…, or so
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
|