-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reference equality on numbers that aren't non-small integers #23
Comments
This is roughly equivalent to the `is` operator in Python, although the precise semantics in the face of numbers is muddy (see SOM-st/SOM#23).
For integers, the test suite prefers that Thus, I'd consider this "specified", and Though for Historically, pointer equality was always a point where one was able to observe implementation strategy. For Unrelated, there is a strong precedence and preference for class names alway to start with a capital letter. |
Makes sense.
OK, fair enough, I can certainly live with that. I'll adjust yksom accordingly. |
This is roughly equivalent to the `is` operator in Python in that it checks normal objects for pointer equality, but numbers are checked for value equality. Note that SOM (or, at least, java-som) doesn't define/implement the latter cases properly yet (see SOM-st/SOM#23) so this commit makes us diverge slightly.
This is roughly equivalent to the `is` operator in Python in that it checks normal objects for pointer equality, but numbers are checked for value equality. Note that SOM (or, at least, java-som) doesn't define/implement the latter cases properly yet (see SOM-st/SOM#23) so this commit makes us diverge slightly.
55: More comparisons r=ptersilie a=ltratt This PR adds more comparisons to yksom: reference equality (1dca2bc) and various comparisons for doubles (82d35c5). Notice that the former commit means that we diverge slightly from SOM's current semantics (see SOM-st/SOM#23) although I think it's fair to say that @smarr thinks the approach we're taking in this PR is the right one (and if I've got that wrong, hopefully he'll shout!). Co-authored-by: Laurence Tratt <[email protected]>
55: More comparisons r=vext01 a=ltratt This PR adds more comparisons to yksom: reference equality (1dca2bc) and various comparisons for doubles (82d35c5). Notice that the former commit means that we diverge slightly from SOM's current semantics (see SOM-st/SOM#23) although I think it's fair to say that @smarr thinks the approach we're taking in this PR is the right one (and if I've got that wrong, hopefully he'll shout!). Co-authored-by: Laurence Tratt <[email protected]>
AIUI,
=
means "perform equality check on an object's data" and==
means "pointer equality". However the latter is overriden for small integers, but not big integers or doubles. So, given this program:the output in java-som is:
In the interests of consistency, I tend to think those should all be
true
or all befalse
. If they should all befalse
, then one has trickier cases like1 == 1.0
and so on. Perhaps reference equality should always return false for numbers?The text was updated successfully, but these errors were encountered: