There are several classes in JCuda that can be considered as "value classes": Plain old data structures that are direct ports of the structs in C, using only public fields.
In #6 it was proposed to add equals and hashCode implementations to (one of) these classes.
While it might be appropriate and in line with certain usage patterns in Java, it might distort the semantics in other cases. Some of these value classes contain Pointer objects, which may make an appropriate implementation of equals and hashCode difficult and involve subtle caveats.
For now, the trade-off between usefulness and possible caveats for me seems to be in favor of not implementing these methods. One could also say that the C structs are not C++ classes and do not overload the == operator - and even less are considered to be used as keys in an unordered_map. However, I'll leave this issue here open for comments, until a final decision is made.
There are several classes in JCuda that can be considered as "value classes": Plain old data structures that are direct ports of the
structs in C, using only public fields.In #6 it was proposed to add
equalsandhashCodeimplementations to (one of) these classes.While it might be appropriate and in line with certain usage patterns in Java, it might distort the semantics in other cases. Some of these value classes contain
Pointerobjects, which may make an appropriate implementation ofequalsandhashCodedifficult and involve subtle caveats.For now, the trade-off between usefulness and possible caveats for me seems to be in favor of not implementing these methods. One could also say that the C structs are not C++ classes and do not overload the
==operator - and even less are considered to be used as keys in anunordered_map. However, I'll leave this issue here open for comments, until a final decision is made.