[squeak-dev] Date hash is broken

David T. Lewis lewis at mail.msen.com
Wed Oct 17 23:11:44 UTC 2018


On Wed, Oct 17, 2018 at 07:35:46AM -0700, Chris Cunningham 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

Related to this issue, I would like to point out a post by Richard O'Keefe
in that same discussion on the Pharo list:

 http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/2018-October/040980.html

This is very much worth reading, as it provides a clear explanation of
a conceptual (not technical) problem that leads to side-effect issues
such as the one under discussion here.

I am not advocating making any changes, just recommending that interested
Squeakers read Richard's post.

Dave



More information about the Squeak-dev mailing list