Open JorgeCepeda opened 1 year ago
Maybe introduce the eq
, ~==
, ~=
or #=
or something similar for equals()? I think a lot of code would break if you replaced all == with equals()
Alternatively, <value> eq
could create a predicate and <value> eq <otherValue>
would test that predicate.
So <value> eq
would be compiled to otherVal -> <value>.equals(otherVal)
and <value> eq <otherValue>
would become (<value> eq).test(<otherValue>)
which is otherVal -> <value>.equals(otherVal).test(<otherValue>)
Could you explain it differently? I got lost in the third paragraph. Maybe this == behaviour could be opt-in per file or something?
I was just thinking of how it could be implemented in a way that java understands it, because at the end of the day, all these manifold features are just syntactical sugar that needs to be compiled down to java.
Like in some languages like Rust, make == compare by value using equals() if configured to do so, while maintaining some way of comparing pointer equality