#! @file ordered.sakura #! @author John Christman (sorakatadzuma@gmail.com) #! @copyright Malunal Studios, LLC. #! @license MIT #! #! Contains the ordered trait, which a type implements for its values to have an #! order, and which numbers, enums, and pointers have. module core; #! A type whose values have an order. #! #! `compare` gives a negative number when `this` comes before `other`, zero when #! they are equal, and a positive number when it comes after. `<`, `<=`, `>`, #! and `>=` between two values of the type call it, as `==` calls `equals`, #! which an ordered type also gives, so the two always agree. Numbers, enums, #! and pointers are ordered without declaring anything. pub trait ordered : equatable { #! Compares this value with another of the same type, for their order. #! @param this The value to compare against. #! @param other The value to compare with. #! @returns A negative number where this value comes first, zero where they #! are equal, and a positive number where it comes after. def compare(&this, other: &self): i64; }