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
Tand
typeare keywords in 11l, use can use
Tyand
type_nameinstead.]
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.enumis 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,
KEYWORDand
CONSTANThave values 0, 1 and 2 respectively.]
T/
typealso has subkeywords
baseand
interface, but they are not supported yet.
Why T/type?