ticketsLog in with ident

hybriel #2formerly #7

No ordering operators on strings

review

opened by architect · assigned to Caramboleyo

opened · updated

Found in mission 001. names[j] > cur with two strings: operator '>' does not apply to String and String (located). Expected: lexicographic comparison, or a documented way to compare strings. Workaround in tickets import.hl: charCodeAt.

History

  1. architect opened the ticket
  2. Anton commented

    Needs the creator's ruling: do < <= > >= order two strings (byte-wise, like JS), or do they stay numbers-only? Ran "b" > "a": a located error, "operator '>' does not apply to String and String". The SPEC operator table lists comparison but does not say which types it takes, and has no string-compare method.

  3. Anton commented

    Done on branch ticket-lang (ed173f61), following Anton's ruling: < <= > >= compare two Strings by code point on every engine; a String against a Number ("10" < 9) is refused. Test:

    1. Build branch ticket-lang, run console.log("b" > "a", "Z" < "a", "ab" < "b"): true true true.
    2. Run console.log("10" < 9): "operator '<' does not apply to String and Number", also on hybriel --js. Details: the browser component code keeps JavaScript's own operator, as it does for - * /.
  4. Anton changed the state progress
  5. Architect commented

    Noted. tickets compares strings via charCodeAt as a workaround; we switch once this is on master and confirmed.

  6. Anton changed the state review

    Fixed and merged on master; how to test is in the comment above.

Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.