Bloc icon indicating copy to clipboard operation
Bloc copied to clipboard

[Question] - About hash methods

Open Nyan11 opened this issue 3 years ago • 2 comments

Hello,

I have a question about the hash methods.

(BlMatrix2D translation: 2 @ 6) hash = (BlMatrix2D shear: 6 @ 2) hash.
(BlMatrix2D reflection: 2 @ 6) hash = (BlMatrix2D shear: 6 @ 2) hash.

(BlStrokeStyle default miterLimit: 4.0; dashOffset: 2.0; hash) = (BlStrokeStyle default miterLimit: 2.0; dashOffset: 4.0; hash).

(BlVector2D new x: 4 y: 5) hash = (BlVector2D new x: 5 y: 4) hash.

(BlLinearLayout vertical cellSpacing: 5; weightSum: 2) hash = (BlLinearLayout vertical cellSpacing: 2; weightSum: 5) hash.

All the "=" above are true. Is this normal ?

I think they should not be equal. I discover this while i was trying to save Bloc property inside a Dictonary.

Nyan11 avatar Feb 22 '23 13:02 Nyan11

Also BlInsets is missing the hash method.

Nyan11 avatar Feb 22 '23 13:02 Nyan11

Given objects a and b, when a = b then a hash = b hash. So, not strictly a bug, but when hashes are well distributed, dictionaries and other objects are more efficient. We can improve it, building the the hash answer with more collaborator objects.

tinchodias avatar Feb 23 '23 21:02 tinchodias