Import std.core.interfaces
std.core.interfaces
The Interfaces that the language's operators and strings work through. The built-in types implement the ones that fit them, and a Struct or Class implements one by listing it.
std/core/interfaces.fb
Types
Equatable
interface
Public Interface Equatable
What == says, and != is always its opposite. A Struct that lists Equatable without an Operator == of its own compares its fields, and a Class compares whether two are the same object.
std/core/interfaces.fb, line 7
-
Whether
aandbare equal.
Comparable
interface
Public Interface Comparable Extends Equatable
An order: what < says, which the other comparisons follow unless a type gives its own.
std/core/interfaces.fb, line 13
-
Whether
acomes beforeb. -
Whether
acomes afterb. -
Whether
acomes beforebor is equal to it. -
Whether
acomes afterbor is equal to it.
Hashable
interface
Public Interface Hashable Extends Equatable
A number for Maps and Sets to find a value by, the same for values that are equal. A Struct that lists Hashable without a Hash of its own combines its fields', and a Class's comes from its object.
std/core/interfaces.fb, line 28
-
Its hash, the same for values that are equal.
Printable
interface
Public Interface Printable
What a value shows in a string, like "{point}".
std/core/interfaces.fb, line 34
-
Its text, as a string interpolation like "{value}" shows it.
Formattable
interface
Public Interface Formattable Extends Printable
A value that takes a format spec, the part after the ':' in "{price:.2}" or Format's "{0:>8}": Format gives its text for the spec, or Null when it doesn't take that spec. The numbers, Bool, String, and Enums are Formattable, by the specs the compiler checks.
std/core/interfaces.fb, line 42
-
Its text for a format
spec, like ".2" or ">8", or Null when it doesn't take thatspec.
Numeric
interface
Public Interface Numeric
What arithmetic needs, so generic code like a Sum works on any number.
std/core/interfaces.fb, line 48
-
The number that adding leaves alone: 0.
-
The number that multiplying leaves alone: 1.
-
aandbadded up. -
btaken away froma. -
aandbmultiplied together. -
adivided byb.
Cloneable
interface
Public Interface Cloneable
What makes a copy of itself, which changing one doesn't change the other: arrays and std's collections are Cloneable.
std/core/interfaces.fb, line 65
-
A new value, equal to this one, that changing this one doesn't change.
Defaultable
interface
Public Interface Defaultable
What has a value to start from, for generic code that needs one: the numbers' is 0, Bool's False, String's "", an Enum's its zero, its first value or a @Flags Enum's no flags, and std's collections' is empty. It's DefaultValue, since Default is Select's keyword.
std/core/interfaces.fb, line 73
-
The value to start from, like 0 for a number, "" for a String, or an empty collection.
Sendable
interface
Public Interface Sendable
What can go to another thread, which the compiler decides: numbers, Bools, Strings, Enums, Callbacks, Channels, Mutexes, Atomics, and a Shared Class's objects and Weaks of them, and the Structs, tuples, and fixed arrays whose fields and elements all are, with a T? of any of them. A type can list it, or an Interface that extends it, to have that checked.
Report an issue with this page or with FutureBlitz on GitHub.