Skip to main content

Types

Paraflow has typed inputs to events, functions and skills, and performs type inference through goals and variables where possible. Optional return types can be specified on events, functions and skills.

e.g.:

skill test/basic($input string) object { title string } {
return { title: $input + ": Part 2" };
}

Arrays

Array types can be specified using array[T] where T is the inner type, e.g. array[int].

Objects

Object types can be specified using object { x string, y int, z optional double }.

Type Declarations

New type aliases can be created using the type keyword:

type Book object {
title string,
author string,
description optional string
};

type Library array[Book];

skill library/find_book($title string) object { book optional Book } {
# ...
}

Spec

<parameter-list> := "(" <parameter> { "," <parameter> } ")"
<parameter> := <$identifier> [ "optional" ] <parameter-type>
<parameter-type> :=
"bool" |
"int" |
"double" |
"string" |
"isodate" |
"docref" |
"json"
<table-type> |
<object-type> |
"any"

<table-type> := "table" "(" <table-column> { "," <table-column> } ")"
<table-column> := <identifier> [ "optional" ] <simple-type>
<simple-type> :=
"int" |
"double" |
"string"

<object-type> := "table" "(" <table-column> { "," <table-column> } ")"
<object-field> := <identifier> [ "optional" ] <parameter-type>