T/type keyword



T <type name>
   String s // instance variable
   . String ps // private instance variable [rationale: dot is used for hidden files and folders in Unix]
   F (s) // constructor
      .s = s
   F get_s_len() // member function (method)
      R .s.len

[Because
T
and
type
are keywords in 11l, use can use
Ty
and
type_name
instead.]



Type aliases


T Tuple2[Ty] = Tuple[Ty, Ty] // `Tuple[Ty, Ty]` can be shortened to `(Ty, Ty)`

Type aliases can be used to create named tuples:
T Employee = (String name, Int id)


T/type subkeywords



T.enum
/
type.enum
is used to declare an enumeration, a distinct type that consists of a set of named constants called the enumerator list.
T.enum TokenCategory
   NAME
   KEYWORD
   CONSTANT
   TEST_CATEGORY = 10
[Enumerators
NAME
,
KEYWORD
and
CONSTANT
have values 0, 1 and 2 respectively.]


T
/
type
also has subkeywords
base
and
interface
, but they are not supported yet.


Why T/type?