Different kinds of values

Syntax and values

Numbers, text, and true-or-false answers are different kinds of value. The kind, or type, helps determine what operations make sense.

What do the table’s words mean?

  • Fixed-length means a list keeps its number of places. Mutable means you can replace the value in an existing place. A list of three items still has three places after you change its first item.
  • Insertion order is the order in which map keys were added. It is not alphabetical sorting.
  • Callable means a value can be used as a function: you can call it with parentheses and any required arguments.
  • Singleton absence value is a technical way to say there is one special “no value” value, none.
  • Finite means a number is neither infinity nor an invalid numeric result. IEEE 754 binary64 names the particular 64-bit number format Pliro uses. See floating-point numbers for why some fractions are rounded.

Static checks happen before the program runs; runtime checks happen while it runs. A call’s arity is its number of arguments. Type inference means working out a value’s type from the code without the programmer writing a type label. Pliro checks known argument counts but does not yet generally infer and check all types before running.

Implicit conversion means changing a type automatically. Truthiness means treating another kind of value as true or false. Pliro does neither: a condition needs a Boolean. An operand is a value an operator works on, such as the two numbers in 2 + 3.

Unreachable code could never be executed. An unused name is declared but never read. A definite-return check asks whether every possible path through a function returns a value. Pliro does not yet report these as general checks.

Pliro currently has seven runtime value kinds:

Type Examples Notes
Number 0, 42, 3.14 Finite IEEE 754 binary64.
Text "hello", "🐢" Unicode text.
Boolean true, false Required by conditions and logical operators.
List [1, 2, 3] Ordered, fixed-length, mutable elements.
Map {"name": "Pip"} Insertion-ordered keys and mutable existing values.
Function add, say User or built-in callable value.
None none Singleton absence value.

The compiler checks declarations, duplicate and undefined names, return
placement, project modules, and statically known call arity. It does not yet
perform static type inference or type checking. Conditions, operator operands,
indexes, and indirect calls are normally type-validated at runtime. Unused-name,
unreachable-code, and definite-return analyses are not implemented.

Pliro does not perform implicit conversions or truthiness. For example, 1 + "2" and if 1: are runtime type errors.

Number behavior

Numbers use binary floating-point. Familiar floating-point rounding can occur.
Results must stay finite. Number display uses a short round-trippable decimal
form and does not add .0 to whole values.

Indexes, collection sizes, random bounds, and GPIO pins impose additional
whole-number and range requirements.

Text behavior

Text length, indexing, and iteration count Unicode code points rather than UTF-8
bytes. Text values are immutable.

none

none equals only none. It can be stored, compared, passed, and returned. A
function without an explicit returned value produces none.

Syntax and values · Built-ins · Programming guides