Skip to content

Reference equality on numbers that aren't non-small integers #23

Open
@ltratt

Description

@ltratt

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:

obj1 = (
    run = (
        (1 == 1) println.
        (100 == 100) println.
        ((1 << 200) == (1 << 200)) println.
        (1.0 == 1.0) println.
    )
)

the output in java-som is:

true
true
false
false

In the interests of consistency, I tend to think those should all be true or all be false. If they should all be false, then one has trickier cases like 1 == 1.0 and so on. Perhaps reference equality should always return false for numbers?

Metadata

Metadata

Assignees

No one assigned

    Labels

    specNeeds specification, or is specification related.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions