Bool, a member of an enumeration, a code, a record or a list.
Each value has a type, and the check holds each expression to its type.
Each conversion is explicit: an expression states the conversion it wants, such as if self.c then 1 else 0.
Exact numbers
0.1 is exactly one tenth, and 1000 / 12 stays exactly 250/3.
A value changes only where the program writes round, with its places and its mode.
So the same inputs give the same result on every machine.
A numeric type carries a grid and a range.
Num {precision: int} holds whole numbers, and a where clause narrows the range:
- On an input, the grid and the range say what a request may send. A value off them gets a refusal.
- On a calculation, a precision is a promise. The check proves it, and the value rounds only at
round. Premium,Rate,FactorandPctname what a number is. They share one arithmetic, so the check accepts a premium plus a factor.
Unknown, absent and zero
RSL keeps a missing answer unknown, in place of zero or a typical value.
So a result that depends only on known answers holds for every later answer.
An input that a person buys, such as a deductible, may declare a default with
choice.
A follow-up input belongs to the case only while its condition holds.
vacant_months with when self.vacant is absent for an occupied dwelling, and unknown for a vacant one until someone answers it.
Value addresses
A path names each value: an input, a calculation, or a value of one list item.
A list declared
keyed by a field names each item by its key.
The address stays with the item when other items come or go, so an answer always lands on the right item.
Related
- Types, Numbers and precision and Rounding in the language reference give each form.
Option, Follow-up inputs and Lists and keys give the rules for absent values and addresses.- Results shows how a host reads the open values of a partial request.