Enhance isComparable
function for full Comparable interface implementation
#700
Labels
isComparable
function for full Comparable interface implementation
#700
Hello, this is my first created issue, if there is something wrong just tell me!
The current implementation of the isComparable function only checks if the
equals
method is present on the object. This is leading me to issues when I'm using a custom Drop class that casually also has an implementation ofequals
, but I don't want to make it an implementation of theComparable
interface.When I use the operators
<
,>
,<=
, and>=
the class is detected as an implementation of Comparable and tries to execute the related functions. This happens in the operator code.Proposed Solution
Enhance the
isComparable
function to check for the complete implementation of theComparable
interface, ensuring that the methodsequals
,gt
,geq
,lt
, andleq
are present on the object.I made a fork and a PR for this. I will link it right now.
Benefits
This will ensure that objects are properly evaluated and that they will use the proper comparison functions, improving the robustness of the template evaluation for the operators
<
,>
,<=
, and>=
.Please let me know if this enhancement is acceptable or if there are any changes or additional considerations I should take into account.
The text was updated successfully, but these errors were encountered: