std/bool
import std/bool to use it. Source: src/std/bool.iyi at v0.18.0.
The prelude gives Bool its literals, !, ==, &&/|| and to_s. This module adds the eager operators |, & and ^ (both sides are evaluated; &&/|| are the short-circuit ones), to_unsafe for the 1 or 0 a foreign interface wants, the io spelling of to_s, clone, and a hash that tells true from false so both can be keys in one Hash (the prelude's Object#hash answers the type's id for both).
There is no ordering. A Bool is a truth, not a number; false < true is a convention some languages adopt and nothing in the prelude records. A program that wants to sort by a Bool sorts by to_unsafe.
Boolstruct, reopened
struct ::Bool
# `self` and `other`, both evaluated.
def &(other : Bool) : Bool
# Exactly one of the two.
def ^(other : Bool) : Bool
def clone : Bool
# Two different numbers, so `{true => .., false => ..}` has two keys.
def hash : Int32
def to_s(io : IyiIO) : Nil
# 1 for true, 0 for false.
def to_unsafe : Int32
# `self` or `other`, both evaluated.
def |(other : Bool) : Bool
end
iyi: the rest of
Bool, added to the prelude's.