comparison.carbon 764 B

12345678910111213141516171819202122
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. package Core library "prelude/operators/comparison";
  5. export import library "prelude/types/bool";
  6. // Equality comparison: `a == b` and `a != b`.
  7. interface Eq {
  8. fn Equal[self: Self](other: Self) -> bool;
  9. fn NotEqual[self: Self](other: Self) -> bool;
  10. }
  11. // Relational comparison: `a < b`, `a <= b`, `a > b`, `a >= b`.
  12. interface Ordered {
  13. // TODO: fn Compare
  14. fn Less[self: Self](other: Self) -> bool;
  15. fn LessOrEquivalent[self: Self](other: Self) -> bool;
  16. fn Greater[self: Self](other: Self) -> bool;
  17. fn GreaterOrEquivalent[self: Self](other: Self) -> bool;
  18. }