Hi Sean.

I did not know about quality of generated hash function.
But if I remember correctly the same code is generated for java using
Eclipse or Idea. So it should be good enough.

2017-10-02 16:37 GMT+02:00 Sean P. DeNigris <s...@clipperadams.com>:

> Denis Kudriashov wrote
> > I just use RBGenerateEqualHashRefactoring for this:
> >
> > r := RBGenerateEqualHashRefactoring className: MyClass variables: #(vars
> > which should be used in equal and hash).
> > r execute
>
> That is sooooo cool! I shudder to think how many times I implemented just
> that by hand!!
>
> Two questions/comments about the generated code:
> 1. #=
>         ...
>         self class = anObject class "should compare #species instead?"
>                 ifFalse: [ ^ false ].
>         ...
> Typically, I've seen #species instead of #class in the guard statement.
> Should we change it to that?
>
>
> 2. #hash
>         ^ var1 hash bitXor: (var2 hash bitXor: var3 hash)
> Is this implementation always safe? It's what I usually hand roll based on
> what I've seen, but Andres Valloud wrote a whole (large) book on hashing,
> so
> I've always wondered if I was missing something…
>
>
>
> -----
> Cheers,
> Sean
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>
>

Reply via email to