Hi,

On Tue, Oct 16, 2018 at 1:28 PM Alistair Grant <akgrant0...@gmail.com>
wrote:

> Hi Petr,
>
> On Tue, 16 Oct 2018 at 21:25, Petr Fischer via Pharo-users
> <pharo-users@lists.pharo.org> wrote:
> >
> > My problem - use Dates as Dictionary keys - shortly:
> >
> > d1 := Date today translateToUTC.
> > d2 := Date today.
> >
> > d1 = d2. (true!)
>
> Of course, this doesn't help with using Date as a key in a dictionary.
> Probably your best option is to look at Sven's excellent ZTimezone
> package (although I haven't tested it in this scenario).
>

The base problem here is that the hash of the dates is not the same for
dates that are equal - that should never happen.  If you try
d1 hash = d2 hash
you should see that the hash's are different (Petr for sure; you for the
cases where the offsets are different).

When objects (especially fo the same class) are =, then their hash must be
the same as well, or things break.

-cbc

Reply via email to