[NAME]
ALL.dao.type.tuple

[TITLE]
Tuple Type

[DESCRIPTION]

A tuple is an ordered list of a fixed number of items with the same type or different ty
pes. Each item in a tuple can optionally have a field name.

 0.1  Definition 
     
   1  TupleEnum ::= '(' [ Identifier '=' ] Expression { ',' [ Identifier '=' ] Expression } ')'
   2  TupleEnum2 ::= 'tuple' '{' [ Identifier '=' ] Expression { ',' [ Identifier '=' ] Expression } '}'
   3  
   4  Tuple ::= TupleEnum | TupleEnum2
     


 0.2  Examples 
     
   1  var tup1 = ( 123, 'abc' )  # tuple with unnamed items;
   2  var tup2 = ( index = 123, 'abc' )  # first item is named as "index";
   3  var tup3 = tuple{ 123, name = 'abc' }
   4  
   5  global __result__ = tup3
   6  global __answer__ = ( 123, 'abc' );
     


 0.3  Tuple Type Name 

The type names of tuples are slightly more sophisticated than type names of array, list o
r map. 
     
   1  AnyTuple ::= 'tuple' [ '<' [ '...' ] '>' ]
   2  TupleItemType ::= [ Identifier ':' ] Type
   3  NonEmptyTupleType ::= 'tuple' '<' TupleItemType ( ',' TupleItemType )* [ '...' ] '>'
   4  TupleType ::= AnyTuple | NonEmptyTupleType
     
A tuple type with '...' at the end of item type list is a variadic tuple type, which indi
cates that a tuple matching to this type may contain more items than the listed item type
s.

 0.4  Example Types 
     
   1  tup1 :tuple<int,int> = (1, 2)
   2  tup2 :tuple<index:int,name:string> = (123, 'abc')
   3  tup3 :tuple<int,int,...> = (1, 2, 3, 'abc')