Expand description
The sentences a program stops with, written once for every tier.
This is the lowest crate every engine and every compiled program links, so a runtime failure’s wording
lives here and nowhere else: the interpreter and the VM report these strings, the generated Rust
panics with them, and the hosts written in other languages are generated from them
(logicaffeine_compile::semantics::failcode).
A broken contract (Require that c, otherwise r.) reports its reason, which must be Text. Every engine
refuses a non-Text reason with the same sentence, naming the LOGOS type it got, so the compiled tier
routes the reason value through contract_reason. A type with no implementation here does not
compile — never a report in the wrong words.
Constants§
- BITAND_
OPERANDS - The reason
&stops a program: an operand it has no bits for (a negative big integer, a big integer beside a value that is not a low mask2^k - 1, or a kind&does not combine). - BITOR_
OPERANDS - The reason
|stops a program: a big integer, or a kind|does not combine. - BITXOR_
OPERANDS - The reason
^(xor) stops a program: a big integer, or a kind it does not combine. - CALL_
DEPTH_ EXCEEDED - The reason a program stops when its calls nest deeper than its stack holds: the interpreter and the VM at their call-depth limit, a compiled program at the end of its stack.
- DIVIDE_
BY_ ZERO_ QUANTITY - A quantity divided by a quantity whose magnitude is zero.
- DIVIDE_
MONEY_ BY_ ZERO - Money divided by the number zero.
- DIVIDE_
MONEY_ BY_ ZERO_ AMOUNT - Money divided by money whose amount is zero.
- DIVIDE_
QUANTITY_ BY_ ZERO - A quantity divided by the number zero.
- DIVISION_
BY_ ZERO - The reason an integer division by zero stops a program.
- INT_
TOO_ WIDE - The reason a compiled program stops when an integer past a machine word reaches a place it holds one.
- MODULO_
BY_ ZERO - The reason an integer remainder by zero stops a program.
- MODULUS_
NOT_ POSITIVE modular(v, m)withm <= 0.- NO_
EXCHANGE_ RATES - A conversion with no rates in scope at all.
- NO_
MODULAR_ INVERSE - A modular division whose divisor shares a factor with the modulus.
- SET_
FIELD_ ON_ NON_ RECORD - The stop for setting a field of a value that is not a record.
- SHL_
OPERANDS - The reason a left shift stops a program: an operand that is not a machine-word integer.
- SHR_
OPERANDS - The reason a right shift stops a program: an operand that is not a machine-word integer.
Traits§
- Contract
Reason - A value that can stand after
otherwise. - Failure
Text - A value as a failure sentence names it: exactly as
Showprints it.
Functions§
- answered
- The value an operation of the exact extension answered, or the stop its refusal names: the sentence the interpreter reports for the same operation on the same values.
- cannot_
convert convert(q, unit)to a unit of another dimension: the quantity’s own unit and the one asked for.- cannot_
read_ bytes readBytes(path)on a file that cannot be read, with the reason the system gave.- contract_
reason - The report a broken contract stops with.
- currencies_
differ verb(add,subtract,compare) applied to money in two currencies.- decimal_
needs_ text_ or_ int decimal(…)given a value of another kind than Text, Int or Decimal, named as the engines name it.- field_
access_ on - The stop for reading a field of a value that is not a record: a value of
type_name. - found
- The value a map lookup found for
key, or the stopkey_not_foundnames. - index_
out_ of_ bounds - The reason an index outside a sequence or a text stops a program: the index as the program wrote it (1-based, or negative from the end).
- invalid_
utf8 - The reason
text_from_bytesstops a program whose bytes are not UTF-8: the decoder’s own account of where they stop being it. - invalid_
uuid - Text that is not a UUID.
- key_
not_ found - The reason reading a key a map does not hold stops a program: the key as
Showprints it. - modular_
rings_ differ op(add,subtract,multiply,divide) applied to two residues of different moduli.- no_
exchange_ rate - A conversion between two currencies with no rate for either in scope.
- not_
a_ decimal - Text
decimal(…)cannot read as a base-10 number. - not_
a_ timestamp - Text that is not an RFC 3339 timestamp.
- pop_
from_ empty - The reason popping a list with no items stops a program: the list as the program writes it
(
xs,b's items). - quantities_
differ verb(add,subtract) applied to two quantities whose dimensions differ.- quantities_
uncomparable - Two quantities compared across dimensions.
- unknown_
currency - A currency code no currency table holds.
- unknown_
time_ zone - A time zone name no zone table holds.
- unknown_
unit - A unit name no unit table holds.
- uuid_
needs_ 16_ bytes uuid_from_bytesgiven the wrong number of bytes.