You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
string:Char is represented by sexpr char. A string single shape is represented by the value itself. Every other string subtype is represented by a disjunction of (at most) two conjunctions (one per char and non-char subsets).
Ballerina Syntax
Sexpr
"ABC"
"ABC"
"A"
"A"
string:Char
char
"ABC" | "A"
(| "A" "ABC")
string & !"ABC" &!"A"
(& string (! "A" "ABC"))
"ABC" | string:Char
(| char "ABC")
string:Char & !"Y" & !"Z"
(& char (! "Y" "Z"))
"ABC" | string:Char & !"Z"
(| (& char (! "Z")) "ABC")
"A" | (string & !string:Char)
(| "A" (& string (! char)))
"A" | (string & !string:Char & !"XYZ")
(| "A" (& string (! char "XYZ")))
List/Mapping/Function subtypes
Each list/mapping/function types consist of multiple atoms. Atoms are created as below
and each atom is given a name. Those atom references are then combined as a disjunction of conjunctions.
Eg:
Internal representation: (A & !B & !C) | D
Sexpr: (| (& A (! B C)) D)
List atoms
Ballerina Syntax
Sexpr Atoms
[int, string]
(list (int string))
[int, string, float...]
(list (int string) float)
[int, string, string]
(min-length-list (int string) 3)
[int, string, string, boolean...]
(min-length-list (int string) 3 boolean)
string[0]
(list ())
int[10]
(array int 10)
int[]
(array int)
()[]
(array ())
Ballerina Syntax
Sexpr
(any|error)[] & !int[]
(& list (! LT.9))
Mapping atoms
Ballerina Syntax
Sexpr Atoms
map<int>
(map int)
record {| int...; |}
(map int)
map<()>
(map ())
record {| int x; string y; |}
(mapping (("x" int) ("y" string)))
record {| string x; string y; int...; |}
(mapping (("x" string) ("y" string)) int)
record {| |}
(mapping ())
Table subtypes
Ballerina Syntax
Sexpr
table<record {| int k; int v; |}>
(table MT.10) where (MT.10 (mapping (("k" int) ("v" int))))
table<record {| int a; |}> & !table<record {| int b; |}>