custom equals when creating an atom#79
Conversation
|
Hey, thanks for working on this! Could you please provide a use case that you're trying to solve with this? In general I'm in favor of making equality configurable for atoms, but I would prefer if it was done on at a higher abstraction layer, possibly. I think it's easy to use custom equality with POJOs in a wrong way, so I'd like to better understand what do you want to achieve here. Another question is about lensing into a |
|
Hi! The use case is that I want to have a custom equality check for the atom value and at the same time for it to be a serializable POJO (no functions as fields), therefore I cannot use an I see that in many places we already pass the equals function as a parameter when constructing atoms, so this change seems logical. As for lensed atoms, one of the tests I've added shows the behavior which I think is OK (derived atom only updating when parent atom with custom equality updates). |
This will allow
Atom.createclients to provide a custom implementation of equality check explicitly, instead of having anequalsmethod on the value.This can be useful when we want to have the atom's value as a serializable POJO that could not have any function members.