E01095: '<=?' and '>=?' were removed - on equal values '<?' and '>?' now give the LEFT operand, so write '<?' for '<=?' and '>?' for '>=?'
What went wrong
'<=?' and '>=?' no longer exist. They were the comparison coalescing operators that kept the LEFT operand when two values compare equal, while '<?' and '>?' kept the RIGHT one. That difference is gone: on a tie ('<=>' gives 0) '<?' and '>?' now give the LEFT operand too, so each removed operator has a plain replacement. This no longer compiles:
rtn: first <=? second //removed: write '<?', which gives the left operand on a tie
The grammar keeps the two tokens only to give this error, as it keeps 'break' and 'return'.
Worked examples
Compilable examples demonstrating this error and the correct fix:
- ek9 -q 963 (How does the <? coalescing minimum operator work in EK9?)
- ek9 -q 243 (How do coalescing operators handle unset values in EK9?)
How to fix it
Write '<?' in place of the removed '<=?', and '>?' in place of the removed '>=?'. The result is the same: on equal values the left operand is returned.
rtn: first <? second
If you want the RIGHT operand on a tie (what '<?' and '>?' used to give), swap the operands: 'second <? first' returns 'first' when they compare equal.
Common causes
- Code written before the tie rule was made the same for all four operators
- Java habit: '<=' and '>=' have an inclusive form, so an inclusive coalescing form was expected
- AI-written code that remembers the old operator family
See also
- E01095: '<=?' and '>=?' were removed (this error)
- E07187: '<?' and '>?' on a type whose values can be of different run-time types
- E07620: '<?' or '>?' on a type that has no '<=>' (or none that survives)
- E08269: a coalescing operator mixed with a different binary operator without parentheses
- https://ek9.io/operators.html#coalescing
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E01095: '<=?' and '>=?' were removed - on equal values '<?' and '>?' now give the LEFT operand, so write '<?' for '<=?' and '>?' for '>=?'
#!ek9 defines module error.e01095.bad defines function earlierStart() -> first as Time second as Time <- rtn as Time? rtn: first <=? second //removed: write '<?', which gives the left operand on a tie laterStart() -> first as Time second as Time <- rtn as Time? rtn: first >=? second //removed: write '>?', which gives the left operand on a tie
Fixed: Write '<?' or '>?' - on a tie they give the left operand
#!ek9 defines module error.e01095.good defines function earlierStart() -> first as Time second as Time <- rtn as Time? rtn: first <? second laterStart() -> first as Time second as Time <- rtn as Time? rtn: first >? second
Questions and answers
These Q&A entries show E01095 and its fix:
Found a problem?
If EK9 reported E01095 for a program you think is valid, or did not report it where it should have, use the compiler form with the smallest program that shows it. If this page is wrong or unclear, use the documentation form. Both are at github.com/ek9lang/ek9-issues.