Skip to content

boolean values are not comparable #1585

@krader1961

Description

@krader1961
Contributor

While working of #1570 I tried this to verify that a constant key results in no change to the order of the inputs:

> order [1 3 2 5 4] &key={|a| put $true }
Exception: bad value: inputs to "compare" or "order" must be comparable values, but is uncomparable values

I thought I had a bug in my &key implementation but it turns out that the current Elvish implementation does not support comparing booleans:

> order [$true $false]
Exception: bad value: inputs to "compare" or "order" must be comparable values, but is uncomparable values

Yes, this is an odd thing to do but it should be possible to compare booleans. Note that this isn't a problem with the order command -- it's a problem with the compare command (whose implementation order uses for comparisons):

> compare $true $false
Exception: bad value: inputs to "compare" or "order" must be comparable values, but is uncomparable values
[tty 25], line 1: compare $true $false

Activity

added a commit that references this issue on Aug 29, 2022
eed6a99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @krader1961

      Issue actions

        boolean values are not comparable · Issue #1585 · elves/elvish