System built-ins

Flux contains many preassigned values. These preassigned values are defined in the source files for the various built-in packages.

When a built-in value is not expressible in Flux, its value may be defined by the hosting environment. All such values must have a corresponding builtin statement to declare the existence and type of the built-in value.

  1. BuiltinStatement = "builtin" identifer ":" TypeExpression .
  2. TypeExpression = MonoType ["where" Constraints] .
  3. MonoType = Tvar | Basic | Array | Record | Function .
  4. Tvar = "A" "Z" .
  5. Basic = "int" | "uint" | "float" | "string" | "bool" | "time" | "duration" | "bytes" | "regexp" .
  6. Array = "[" MonoType "]" .
  7. Record = ( "{" [Properties] "}" ) | ( "{" Tvar "with" Properties "}" ) .
  8. Function = "(" [Parameters] ")" "=>" MonoType .
  9. Properties = Property { "," Property } .
  10. Property = identifier ":" MonoType .
  11. Parameters = Parameter { "," Parameter } .
  12. Parameter = [ "<-" | "?" ] identifier ":" MonoType .
  13. Constraints = Constraint { "," Constraint } .
  14. Constraint = Tvar ":" Kinds .
  15. Kinds = identifier { "+" identifier } .
Example
  1. builtin filter : (<-tables: [T], fn: (r: T) => bool) => [T]