Proposal: Sameness operators
Tom Hawtin
Thomas.Hawtin at Sun.COM
Wed Apr 1 11:26:43 PDT 2009
Christian Fischer wrote:
> These $-operators doesn't seem intuitive to me, but replacing equal-calls
> sounds interesting.
>
> Maybe a better solution would be something like this:
> if (a eq b) // equals
> if (a ne b) // not equal
> if (a lt b) // lesser than
> if (a le b) // lesser or equal
Along with other concerns, four new keywords?! Theoretically they could
be context sensitive, but then we are boxing in the grammar.
If something like this were to be done (and let's face it, operator
overloading ain't gonna happen in JDK7), then I think there needs to be
to changes in fundamental direction of the proposal.
* We need new symbols. .<. and the like were proposed in another
similar proposal. So long as the symbol is a sequence of characters
which is not valid in an existing Java program (outside of comments and
literal strings).
* I think it's clear that we can't use Comparable.compareTo and
Object.equals. It requires a new method for each operator.
Tom
More information about the coin-dev
mailing list